Python Study Notes (1) python Basics

Source: Internet
Author: User

1. Constants

Constant unknown

Not Required


2. Number

Integer, long integer, floating point, plural


3. String

Single, double, and triple quotation marks can all represent strings.

R + String indicates the native string without escaping

U + string can represent Chinese

Addition achieves join and multiplication achieves multiple copies. "character". join (str) indicates that strings are separated by characters.

The eval () function converts a string type to code execution.


4. Variables

It starts with a letter and is case sensitive. It can contain _, which is the same as the variable naming rule in c.


5. Data Types

Number, String, linear container, hash container DIct, set

None indicates null

Logical type True, Flase


6. Operators and expressions

Operators have the same priority.

Logical statement:

If, eif, else:

Note that the next level should be indented.

Loop statement:

For in range () and for int xrange (header, tail, interval)

While condition:

Note that python does not have auto-incrementing auto-Subtraction

Else is supported after the loop statement.


7. Functions

Def function name (parameter = can have an initial value ):

If no value is returned, None is returned by default.

Functions can be copied directly.

You can declare a function before calling it.

You can add a help document to the function, and use the three quotation marks "" content ""

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.