Python basic learning notes

Source: Internet
Author: User

Python basic learning notes
Python basic learning Notes 1. python data types: 1. Numbers (1) Boolean (2) INTEGER (3) floating point 2. Sequence type (1) string (2) tuples (3) List 3. Image type (1) dictionary 4. Set Type (1) variable set (2) immutable set 2. python annotation method 1. Single-line Annotation with "#" for single-line annotation 1 # This is a single-line python annotation 2. Multi-line annotation multiple-line Annotation with one to three single quotes for Annotation

'''This is a python multi-line comment '''

 

Iii. character encoding 1. ASSIC: use an 8-bit length to save a character ord () function. You can see the assic code of a character 2. Unicode: use 16-bit length to save a character 3, UTF-8: variable length, 3 bytes to store one Chinese Character 12 a = 'abc' at this time, use assic to save B = u'abc' at this time, use unicode to save 4. Import Module 1. OS module can be used for System Management, you can use the system () method to execute system commands. This method returns the command execution result. 0 indicates that the command is successful, and other numbers indicate that the OS fails. walk. the next () method can output directory tree 2 and commands module commond in sequence. the getstatusoutput () method returns a tuple with the command execution result. The output of the command is 3. The method of the import module is as follows: import Module name // This will import all methods of this module from Module name import method name // This will import this method under this module import module name as new module name // This will rename the module when importing the module. 5. User Interaction 1. input () function: the input () function is processed based on the input content type, the input number is a number type, and the input string is a string type. 2. raw_input () function: raw_input () function. All input content through this function is processed as a string. 6. Process Control 1. Determine if ...:...... Elif ...:...... Else :...... 2. for Loop for I in {range }:...... 3. while loop while... :...... Else :......

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.