Python Learning Notes

Source: Internet
Author: User

    1. The most basic data structure of Python is the sequence

The six built-in data structures are: list, tuple, string, Unicode string, buffer object and Xrange object


2. Basic data types (variable and immutable types) (single and double quotes are not distinguished, integers are not used, Boolean numbers are not, the type method can view types)

Integral: Integral type (immutable type, view with ID method, Integer object ID is different) and Boolean (True&false)

Floating-point types: floating-point numbers, complex numbers (3+2j), decimal digits

String (immutable type, must be in quotation marks, single double quotation marks are not distinguished): It's already a sequence, you can extract a part of it.


3. Naming rules

Numbers, letters, underscores

Note that, _x,_x_,__x, this type has a special meaning in Python, unless you have a special need to avoid conflicts with definitions in the system as quickly as possible.

It is also important to note that in Python, the variable name has no data type, its object has a data type, such as name = 1.23, at this point, the name Object data type is float, again, name = Tom, then the name Object data type is a string, so, with C, The difference between strongly typed variable references in Java


The list is defined by [], which is a variable type variable, which belongs to a nested type

Tuples are defined by (), are immutable type variables, are also nested, note the models that understand their memory, they are references in modifying data structures, and can be understood to point to problems


4. Logical operators

4 Set of Operators

A. Identity operator: is

B. Comparison operator: >,<,>=.<=,!=,==

C. Member operators: In, No in

D. Logical operator: And,or,not



Python Learning Notes

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.