Архив метки: шпаргалка

Шпаргалка по типам данных в Python

Text Type: str
Numeric Types: int, float, complex
Sequence Types: list(список), tuple(кортеж), range
Mapping Type: dict(словарь)
Set Types: set, frozenset
Boolean Type: bool
Binary Types: bytes, bytearray, memoryview
x = "Hello World" str
x = 20 int
x = 20.5 float
x = 1j complex
x = ["apple", "banana", "cherry"] list(список)
x = ("apple", "banana", "cherry") tuple(кортеж)
x = range(6) range
x = {"name" : "John", "age" : 36} dict(словарь)
x = {"apple", "banana", "cherry"} set
x = frozenset({"apple", "banana", "cherry"}) frozenset
x = True bool
x = b"Hello" bytes
x = bytearray(5) bytearray
x = memoryview(bytes(5)) memoryview