Python study Note 2, basic knowledge, python study note knowledge
1. in python, # The comment content starts with the pound key, and the interpreter does not care about it;
2. in python: the indentation at the end of a colon is the code block. This is a Convention and it sticks to a single indentation with four spaces. (Sublime Text sets four spaces at the top of a tab: In preference --> seting-user, add the following sentence to brackets: "tab_size": 4, "translate_tabs_to_spaces ": true ,)
3. python is case sensitive.
4. What should I do if single quotation marks or double quotation marks are required for output in python? The escape character must be indicated by a backslash ('). If single quotation marks are required, the backslash (') must be entered \', double quotation marks are required to write the backslash double quotation marks \"
Print () output characters can be enclosed in single double quotation marks, but no single double quotation marks are provided for output, because they are not part of the characters themselves:
5. escape characters: \ n line breaks, \ t tabs, \ backslash; \ errors will occur here, however, if you write ('\ t') in the print function, a tab is output, print (' \ t ') two slashes and a t character will be output. If I don't want to implement the escape function, I can write the characters inside R' that I don't want to escape, for example: print (R' \ t \ n ')
6. If you need to edit multiple lines in interactive mode, add three single quotes ''' to the front. If you need to output three single quotes, add them to the front''
7. In python, "and" indicates and operations. "or" indicates or operations. "not" indicates non-operations. True or False indicates the operation results,
8. python is a weak language and can be assigned values between different variable types,
9. The division result is a floating point number. // (called floor division, haha) the integer part of the result. % Division is the remainder of the result.