types - Python

The typesmodule stores the constant names of the built-in object types. FunctionType, DictType, ListType, and StringTypeare examples of the built-in type names.

You can use these constants to find out the type of an object.

>>> import types
>>>if type("Parrot") == types.StringType:
… Print "This is a string!"

This is a string

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Python Topics