Python Learning Notes

Source: Internet
Author: User

One: Print statement

Print statements can be printed out. Where the concatenation of strings is used instead of +, which is different from Java.

print ' Hello ', ' world '--printing Hello World

Two: Notes

Python is annotated with #, such as: #print ' Hello ';

Three: Variables

In Python, the equals sign = is an assignment statement that assigns any data type to a variable, the same variable can be repeatedly assigned, and can be a variable of different types.

Python, like JS, is dynamic. The type of a variable is determined by its value, not when it is compiled.

Four: string

Analogous to JS, strings can be represented by "or".

If the string contains single quotation marks, the string is represented in double quotation marks, enclosed in single quotation marks if the string contains double quotation marks, or escaped with \ If both are available.

Multiline string: Python provides three quotation marks, strings in three quotation marks can be written in a newline, and printed in a newline.

Raw string: Use R to modify the string, equivalent to the string contains the quotation marks, special symbols, such as the need to explicitly escape the \ to extract out.

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.