1.Python Script Specification Base template#Coding:utf8ImportTime , RE, OS, sys, time,urllib2,shutil,stringImportJson,datetime#set UTF-8 encoding formatReload (SYS) sys.setdefaultencoding ("Utf-8" )#gets the first n days of the current
defMain (): number= Int (Input ("Please enter the total number of students:"))#Enter the total number of students to be enteredCount = number#use a variable to save the total number of studentsStudents = List ()#Create a list to store student
1 classCompany :2 def __init__(Self, name, staffs=[]):#There is no incoming list when the entity object is instantiated, causing the entity object to share the same default list object3Self.name =name4Self.staffs =Staffs5 6 defAdd (Self,
PYTHON-M Module NameDirect the current directory "as the running path of the module, without the need for import to run directlyFor example:Python-m simplehttpserver #python2中启动一个简单的http服务器python-M http.server #python3中启动一个简单的http服务器The above
Chapter Content
Introduced
The forming process of the adorner
Open Closure principle
Talking about the main function of the adorner and the fixed structure of the adorner
Adorner with parameters
Multiple adorners
1, Time module: times, DateTime;1), Timestamp (SEC) 1970 00:00:00 defined as 0;time.time ()2), formatted time string3), tuple (struct_time) 9 elements: Year, month, day, time, minute,seconds, weeks, the day of the year 0-6, tm_isdst=0;access Method:
Difficulties:1 groupingIn the Re.findall () method, if there is a () in the regular expression, the matching result of the parentheses is returnedInstance1 No parenthesesPrint (Re.findall (' a+\d+\w+ ', ' aaaa1111aaaa,aaa222aa,nnn22cc '))Output ['
1. #先下载pyautogui库, open cmd input pip install Pyautogui, enter2. The code is as follows:Import Os,timeimport Pyautogui as Pagtry: While True: print ("Press Ctrl-c to End") x, y = pag.position () #返回鼠标 The coordinates
program run the process of error swelling? The first idea is to find the source of the problem, how to find it? This is the time to use the exception capture, Python and other languages, as well as some built-in exception classes for programmers to
The use of dichotomy to find premises must be ordered sequencedefSearch (List,val): Start=0 End= Len (list)-1#determine if the number is not in the list ifValinchlist:#Loop until the number is found, return Exit Function while1: Mid= Int (
Tag: Item key value pair class COM add div [] 127.0.0.1 OpenWrite an. ini configuration fileCreates a new Config object, assigns a dictionary to the section, and then writes the file.Import Configparserconfig=configparser. Configparser ()
To export a list of version information for packages installed in this environmentPip Freeze > Requirements.txt Networking, download the package from the list to the All-packet folder[Email protected] ~]# pip download-d./all-packet-r
def assert_element_in_page_source (s):Print type (s)Print S#assert s in Driver.page_sourceCommand= ' Assert_element_in_page_source (U "exit") 'Print "type (command)", type (command)Eval (command)Executes the script file. Error as follows, no reason
Use Python to implement a simple if Loop statement:Password need to use ciphertext:Import Getpass call Getpass library for password ciphertext input_username = ' Alex '_password = ' 123 'Username =input ("username:")Password = getpass.getpass
AtomicAn atom is the most basic constituent unit of a regular expression, with at least one atom in each regular expression. Common types of atoms are:A ordinary character as an atomb nonprinting characters as atomsC Universal characters as atomsD
These days, the province's 2018-year college entrance examination scores have been released. Through the entrance examination of this life mark, first of all congratulations to you in the examination room "fight" students, you temporarily liberated.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service