Getting started with Python programming (2) Introduction to variable types

Source: Internet
Author: User
This article mainly introduces Python variable types. For more information, see Python variable/data types. Some are generated based on some system functions, Others are automatically identified based on the value of the variable., These data type constants are Class typesDefinition. Import typesFor example:

The Code is as follows:

Import types
A = [1, 2, 3]
If type (a) is types. ListType:
Print
Else:
Print 'not list'

Python variables/data types are as follows:

NoneType
None type

TypeType
Type object itself

BooleanType
Boolean Type

IntType
Integer type

LongType
Long Integer

FloatType
Floating Point Type

ComplexType
Plural type (for example, 1.0j will not be defined if not supported)

StringType
String type (e.g. 'Spam ').

UnicodeType
Unicode string (e.g. u 'spam' will not be defined if it is not supported)

TupleType
Tuples

ListType
Linked List array type

DictType
Hash array type (Dictionary array)

DictionaryType
The full name above

FunctionType
Function Type

LambdaType
Function Type backup name

GeneratorType
The iterator object generated by calling the function generator.

CodeType
The type of the Code object, for example, returned by compile.

ClassType
Object Type

InstanceType
Object instance type

MethodType
Object Method

UnboundMethodType
The backup name of MethodType.

BuiltinFunctionType
Built-in function types, such as len () or sys. exit ().

BuiltinMethodType
Alternate name of BuiltinFunction

ModuleType
Module type

FileType
Such as sys. stdout.

XRangeType
Range selection object returned by xrange ()

SliceType
Objects returned by slice ()

EllipsisType
Omitted type.

TracebackType
For example, the object type returned by sys. exc_traceback

FrameType
A backtracing object such as tb. tb_frame

BufferType
Type returned by the buffer () function

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.