Home > Article > Backend Development > Introduction to python core data types
Numbers: int, long, float, complex, bool
Characters: str, unicode
List: list
Dictionary: dict
Tuple: tuple
File: file
Other types: set, frozenset, class type, None
Other file tools: pipes, first-in-first-out pipes (fifos) , Socket file (socket)
Project | Operation |
---|---|
str() | The result is the same as print |
repr() | The exact value of the object, but most use eval(repr(object)) == object |
format() | format(value[, format_spec]) |
Project | Operation |
---|---|
int() | Convert to integer |
float() | Convert to floating point |
Project | Operation |
---|---|
list() | Convert string to list |
tuple() | Convert string to tuple |
set() | Convert string to set |
frozenset() | Convert the string into an immutable set |
dict() | According to ( key, value) tuple list to create a dictionary |
chr() ord()
Item | Operation |
---|---|
Convert the integer Convert to binary string | |
Convert integer to octal string | |
Convert an integer to a hexadecimal string | |
to a numerical value |
The above is the detailed content of Introduction to python core data types. For more information, please follow other related articles on the PHP Chinese website!