Python study Note 2, basic knowledge, python study note knowledge

Source: Internet
Author: User

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.

 

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.