Python Data base type

Source: Internet
Author: User

There are several data types for Python:1. Digital "integral type Int/long, float type Float/complex"
    • Int

integral type General 32bit machine 32 bits wide, 64bit machine 64bit wide.

I=1Print(Thevalue of "I is%d, the type is%s" %(I,type (i)))============================= ========= return Result: The value of I is 1, type is <class'int'>
    • Long

Python3 has integrated int and long, and the conversion will be done automatically.

    • Float

Python's floating-point number is a decimal number in mathematics, similar to a double in the C language.
In operations, the result of an integer and floating-point operation is a floating-point
number

f=2.345Print(Thevalue of "F is%f, type is%s" %(F,type (f)))======================= ======= Returns the result: the value of F is 2. 345000, type is <class'float'>
    • Complex

forms such as A + BJ, where A and b are floating point and J (or J) represent the square root of 1 (this is an imaginary). A is the real part of the number, and B is the imaginary part.

c=1+2jPrint(Thevalue of "C is%s, type is%s" %(str (c), type (c)))===================== ========= return Result: The value of C is (1+2j), type is <class'complex'>
2. Strings String

3. Boolean Boolean4. List of lists5. tuple tuples6. Dictionary Dict
7. Set Set8. Dates Date

Python Data base 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.