Python object data type, python Data Type

Source: Internet
Author: User

Python object data type, python Data Type

For python, everything is an object, all the data stored in the program is an object, and the object is created based on the class

Computers can process a variety of data, such as text, graphics, audio, video, and web pages. Different data types need to be defined.

Class refers to the custom type, and type refers to the built-in type. Both of them indicate different data types.

Each object has an identity, a type, and a value. The identity refers to the pointer of the object in memory (the address in memory), and the built-in function id () returns the identity of an object. The variable name is the name that references the specific location.

Instantiate: create a specific type of object

After an instance is created, its identity and type cannot be changed

If the object value can be modified, it is called a variable object.
If the object value cannot be modified, it is called an immutable object.

Container: an object contains references to other objects, such as a list.

Python is a strongly typed language. The type of an object determines the operations that the object can participate in or the methods it supports, that is, the methods exist in the class, all the functions in the object are found in the class.
Most objects have a large number of unique data attributes and methods.

Attribute: The value related to the object, such as the variable name.

Method: functions that perform certain operations on objects when called

>>> Name = 'test' >>> name. upper () -- Method TEST >>> num = 1 >>> print (num. real) -- property help (type) -- view the methods or properties of a type >>> help (int) help (type. func) -- find the usage of a method >>> help (str. find) usage point (.) you can use the print (type (obj) operator to access attributes and Methods. You can view the class created by the Object> from twisted. internet import reactor> print (type (reactor ))

Core Data Type

Number: int, long, float, complex, bool (0: False, 1: True)

Character: str, unicode

List: list

Tuples: tuple

Dictionary: dict

File: file

Others: set, frozeset, class type, None

The above is the data type in the Python object introduced by the small editor. I hope it will be helpful to you. If you have any questions, please leave a message. The small editor will reply to you in time!

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.