The path to Python: A preliminary knowledge of data types

Source: Internet
Author: User

The path to Python development: data type First knowledge


Data types are important. But I'm telling you, he's not important.

Well, since someone doesn't know the data type, let me tell you about it. This thing doesn't need any Python code anyway.

Data type I am very rigid in my speech. We understand.

There are a lot of data types, because executing commands in Python3 and python2 with variables is the STR string type by default, which can be cumbersome if you want to become a digital inspection list. If you do not use the data type for casting, you will get an error. The input in Python2 is disgusting, because their default data type is the STR string, so you will get an error by typing in a string of numbers.

First of all, the more important and basic two families are:

int (integral type):

Integral type is a series of numbers ... That is the easiest to understand. In Python2, there is another data type similar to int is called long, that is, the length is too long to convert from int to long ...

On a 32-bit machine, the number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483647
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1, which is -9223372036854775808~9223372036854775807long (Long integer)

STR (STRING):

Strings are any combination of letters, numbers, and underscores, and STR is supposed to be a string ... I'm not quite sure, my English is a heap of bugs.

And then the "descendants" that are "changed out" are:

Long (L-integer):

is in the python2 over a certain length of the integer type ... Because very few people use python2, so I don't focus.

Float (floating point):

As the name implies, floating-point numbers are similar to decimals, and floating-point numbers are 3.78798.

Complex (plural):
The complex number consists of real and imaginary parts, the general form is X+yj, where x is the real part of the complex, and Y is the imaginary part of the complex, where x and y are real numbers. Note: Small number pools exist in Python:-5 ~ 257 You guys, this is the data type. But it's just a preliminary. Think about it, there are many ...

The path to Python: A preliminary knowledge of data types

Related Article

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.