Python basic definition

Source: Internet
Author: User

    1. Python's interpreter type:
    • CPython:

After installing Python, the official provides a Python interpreter CPython, written in C, and running Python at the command line is the CPython interpreter that launches the most widely used one.

    • Ipython:

An interpreter based on CPython, similar to CPython, is only enhanced in interactivity;

    • Jpython:

A Python interpreter written in the Java language that can be compiled directly into Java bytecode to run;

    • PyPy:

Its goal is to make Python code execute fast, using JIT technology, dynamic compilation of Python,

    • IronPython

Running on Microsoft's. NET Platform

2.Pythong variables:

Variables in Python do not need to be declared. Each variable must be assigned before it is used, and the variable will not be created until the variable is assigned.

In Python, all uppercase variable names represent constants

  3.python Data type: 

    • Boolean value: (Ture|false)
    • Digital:

Integral type (int):

On a 32-bit machine, the number of integers is 32 bits, namely: -2**31~~2**31-1, that is: -2147483648--2147483647

On a 64-bit machine, the number of integers is 64 bits, namely: -2**63~~2**63-1, that is: -2147483648--2147483647

Long Integer type:

Python does not refer to the positioning width, theoretically can be infinitely large, but limited by memory; but there is no long in the python3, all of them are positive.

    • Float type (float):

 is a set of a specific subset of rational numbers, In Python, the precision is limited to the precision of the default , all languages are the same, with the storage structure of floating-point number is related

Python toolbox, there is a decimal module, GetContext (), where PREC defines the precision, the default is 28, change can be adjusted.

1>>> fromDecimalImportGetContext2>>> fromDecimalImportDecimal3>>>GetContext ()4Context (prec=28, Rounding=round_half_even, emin=-999999999, emax=999999999, Capitals=1, flags=[], traps=[Divisionbyzero, Overflow, invalidoperation])5>>> B = Decimal (1)/decimal (3)6>>>b7Decimal ('0.3333333333333333333333333333')  ///28 of precision values8>>> GetContext (). Prec = 509>>> B = Decimal (1)/decimal (3)Ten>>>b OneDecimal ('0.33333333333333333333333333333333333333333333333333')////50 a precision value.
Decimal Module--enlarging floating point precision

    • String

In Python, the quoted characters are considered strings, multi-line with multi-quotes ("" "), note that the concatenation of the string can only be a string, cannot cross the data type;

    • List

    

Python basic definition

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.