Python tutorial type () function usage and usage

Source: Internet
Author: User

The type () function is a simple and practical method for querying object data types in python. This article mainly introduces the usage and usage of the type () function.
What can the type () function do?

As mentioned in the article about data types, how to view the data types of objects is required. Type () is the most practical and simple way to view data types. Type () is a built-in function. You can call it to obtain an inverse value to know the object type information you want to query.
How to use the type () function

Use type (): type (object)
Type () is to receive an object as a reference, and then return the corresponding type of the object.
>>> Type (1)
<Type 'int'> # integer

>>> Type ('iplaypython ')
<Type 'str'> # string
Type () what type is returned?

>>> Type (1 ))
<Type 'type'> # type
Originally, these return values are of the 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.