Python Core programming--python objects

Source: Internet
Author: User

First, what is a Python object

In Python, a value of any type constructed is an object. For example, a value of an integer type, a string, a list, and so on, can be considered as objects.

All objects are divided into three parts:

(1) identity. Each object has an ID that identifies itself. Available built-in function ID () view

(2) type. Available type () view

(3) value. Objects are used to hold data, and the most important data of course is its value.


Second, the standard type

Number, Integer, Boolean, Long Integer, float, complex, string, list, tuple, dictionary, module, class


Third, slicing objects

Step slices, multidimensional slices

(1) Step slice sequence[start index: End index: Step value]

>>> List1 = [1,2,3,4,5,6,7,8]>>> list1[0:7:2][1, 3, 5, 7]
(2) multi-dimensional slicing sequence[star1:end1,start2:end2]


Iv. standard types of built-in functions

(1) type () return types

(2) CMP (A, B) returns a positive integer if a>b, or a negative integer if a<b

(3) Str () converted to character type


V. Types of factories

Int (), long,float () ....








Python Core programming--python objects

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.