--python Overview of Python Learning

Source: Internet
Author: User
Tags bitwise

1 Advantages of Python

The Python language library is complete, simple in syntax, and has its own installation on Linux, with unique features in handling big data and automation.
2 Python Interpreter

The Python interpreter is used to interpret Python code, and the more popular Python interpreter is:
CPython, use the C interpreter to interpret the Python source as a. pyc file (byte code)
Jpython, using the Java interpreter to interpret python source Code as Java-recognized bytecode
IronPython, using the C # interpreter to interpret the bytecode identified for C #
PyPy, the interpreter is interpreted as bytecode and adds a step to the machine code, which is characterized by fast

3 python encoding

The encoding that is designed in Python:

ASCII, with 8 bits to represent part of the character and number

Unicode, at least 16 bits, contains the characters that each country can use.

Utf-8, the Unicode is compressed to save unnecessary space consumption.

4 Basic data types

The basic data types in Python are:

int integral type

Long integer type

float Float Type

Boolean: True or False; equivalent to 1 or 0

String: "This is a string"

5 Complex data types

The complex data types in Python are:

List: li=[1,2,3,4,]

Tuple Ganso: t1= (1,2,3,4)

Dict dictionary: dic={' K1 ': ' v1 ', ' K2 ', ' v2 '}

6 Basic Process Control

If.. else/if. Elif. else used to select the control flow

For,while loops to control loops

7 Variables and constants

Constants are generally expressed in uppercase letters to differentiate variables such as pi=3.14

8 Indent

Python needs to be indented to determine the scope, the same level of code indentation must be the same amount, such as:

Two print is obviously the same level, then the front indentation must be, the official recommended indent 4 spaces. Of course, it is best to use the IDE tools to write, will automatically indent, can save a lot of trouble.

9 various operations

9.1 Basic Arithmetic operations

+, -, *, /, %, **, //

Is the integer portion of the returned quotient.

9.2 Comparison Operations

= =,! =, <, >=, <=

The result of the comparison operation returns a Boolean value, such as 2>3 returns False

9.3 Bits Operations

& Bitwise AND

| Bitwise OR

^ Bitwise XOR OR

<< left shift, such as 2<<1, returns 4

>> move right, such as 2 >>1, will return 1

--python Overview of Python Learning

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.