Python Learning Summary (c), Python variable type

Source: Internet
Author: User
Tags python list

The value of each variable in 1.python does not require a type declaration, and each variable in-memory creation includes information such as the variable's identity, name, and data.

2. Each variable must be assigned before it is used, and the variable will not be created until the variable is assigned.

3. Allows assigning values to multiple variables at the same time.

45 Standard data types

Numbers (digital)

String (String)

List (lists)

Tuple (tuple)

Dictionary (dictionary)

4. You can delete references to some objects or delete references to multiple objects through Dell.

5.python supports four different types of numbers

int (with character integral type)

Long (length integer, also can represent octal and hexadecimal)

Float (float type)

Complex (plural)

5. Python also supports complex numbers, which consist of real and imaginary parts, and can be represented by a + BJ, or complex (a, b), where both the real and imaginary part of a complex number are floating-point types.

6.python string

Strings consist of numbers, letters, underscores, and Python string lists have two order of values

Left-to-right index starts from 0, right-to-left index starts from 1 by default

Gets a substring in the string, [header subscript: tail subscript], can be positive or negative, but does not include the trailing subscript character.

The plus sign (+) is a string join operator, and an asterisk (*) is a repeating operation.

7.python List

Python uses the most frequent data types. You can complete the data structure implementation of most collection classes, which supports characters, numbers, strings, and even the inclusion of lists

The list is identified by [], Python's most common data type. The value of the cut can also be used in the above method,

8.python tuples

It is also a data type, similar to list, where the tuple uses () to identify the inner elements separated by commas, but cannot be assigned two times.

9.python Dictionary

Is the most flexible built-in data structure type in addition to the list, the list is an ordered collection of objects, and the dictionary is an unordered collection of objects.

The difference: The elements in a dictionary are accessed by keys, not by offsets.

The dictionary is identified with the {} dictionary, which consists of the index key and its corresponding value values.

10. Data type Conversion

You only need to use the data type as a function name

For example:

Int (X[,BASR]) converts an X to an integer.

Python Learning Summary (c), Python variable type

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.