Two: Python object type

Source: Internet
Author: User
Tags set set

---restore content starts---

1, why use built-in types:

A) built-in objects make programs easier to write

b) Built-in objects are extended components

c) Built-in objects tend to be more efficient than custom data structures

d) Built-in objects are part of the language standard

Main built-in objects for 2,python

Object Type Example Constants/create

Digital 1234,3.1415,3+4j,decimal (decimal), fraction (fractional)

The string ' spam ', ' hello,world ' "is immutable, read by relative position, can redefine a string, and take the same variable name, Python will clean up the old object during the run."

list [1,2,3,4,[5, ' spam ']] "ordered set, can be nested, can be dynamically increased or decreased, by relative position to read"

Dictionary {' Work ': ' Zhangfei ', ' Age ': 24} ' can be nested, can be dynamically added and subtracted '

Tuples (1, ' spam ', 4, ' U ') "immutability"

File MyFile = open (' Data.txt ', ' R ')

Set set (' abc '), {' A ', ' B ', ' C '}

Other type types, None,bool

Programming unit type functions, modules, classes

---restore content ends---

Two: Python object type

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.