Variable numbers cannot begin with 1name
Variable special characters cannot start with!name
Variable cannot have a space name of Hello
Variable cannot use keyword as variable name
The ID () function is used to look at the memory address of the variable
Input () Get user input
eval () A variable that matches the name of the input variable is found in the known variable
Indent: There is a colon starting below as long as the indentation of the indented content is entered into the code block as long as a code quickly in the space indentation, you can execute
While loop exits the next line of write break
The while loop is followed by the condition, only the loop is true, and the condition is false the loop jumps out
Couont = Count+1 can also be used with count + = 1 each time a loop variable is called count is added to the default value
and in the judgment must be two conditions are satisfied to continue execution there is a condition that does not conform to exit the loop
Break When the previous statement matches the criteria, you can jump out of a line on a break from a break. The
for loop for x in X i is how many times the loop
type is used to look at the data type
String formatting%s means the empty first place followed by a string instead of print (' name:%s \ n age%s\n job:%s ')
String formatting can also be used with + to achieve the destination print (' Name: ' +name+ ' \nage: ' +age+ ' \njob: ' +job ')
\ n = newline character
"' Three single quotation marks or three double quotation marks for the string Wrap
Strip () string used to remove the whitespace in parentheses around the string can output the deleted content Str.strip (' a ') to delete all the A
Shard indexes in the original string. Regardless of the end of the first index contains The subsequent index does not contain
and the operation two are 1 or two are true to show 1 10&50 = 2
or the operation of one of the 1 is expressed as true both a 1 out of 1 10|50 =, the same as the
different operation of the same as 0 only two is not the same as the 1 of the full 1 out of 0 all 0 out of 1011 out of 1 10^50
continue in the IF while this statement uses the expression to skip directly over the following statement to return the above statement again
for lines in obj:
Print lines read one line at a time to a file The
Obj.read means that all obj.readlines are read, and then the content becomes a list based on the line break
String formatting% string%d integer%d floating-point number%5d indicates that a 5-bit integer is reserved%05d if the integer digit is reserved 4 spaces plus an integer%.XF indicates that the X-bit after the decimal point is reserved
Two-dimensional list acquisition method x = [1,2,[3,4],5] x[2][1]
The hex () function is used to convert 10 binary data into 16 binary
Define a function to use the DEF statement, write down the function name, parentheses, arguments in parentheses, and colons
Isinstance () checks that the supplied function data is not the data isinstance (supplied function variable, required variable type)
Liaoche Python Learning Notes