
Built-in Types — Python 3.13.3 documentation
2 days ago · Text Sequence Type — str ¶ Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways: Single quotes: 'allows embedded "double" quotes' Double quotes: "allows embedded 'single' quotes" Triple quoted: '''Three single quotes ...
Data Types — Python 3.13.3 documentation
3 days ago · Python also provides some built-in data types, in particular, dict, list, set and frozenset, and tuple. The str class is used to hold Unicode strings, and the bytes and bytearray classes are used to hold binary data.
typing — Support for type hints — Python 3.13.3 documentation
2 days ago · TypeIs aims to benefit type narrowing – a technique used by static type checkers to determine a more precise type of an expression within a program’s code flow. Usually type narrowing is done by analyzing conditional code flow and applying the …
string — Common string operations — Python 3.13.3 …
2 days ago · The default version understands ‘s’ (str), ‘r’ (repr) and ‘a’ (ascii) conversion types. Format String Syntax ¶ The str.format() method and the Formatter class share the same syntax for format strings (although in the case of Formatter , subclasses can define their own …
datetime — Basic date and time types — Python 3.13.3 …
This makes it possible to specify a format string for a date object in formatted string literals and when using str.format(). See also strftime() and strptime() Behavior and date.isoformat() . Examples of Usage: date ¶
ctypes — A foreign function library for Python — Python 3.13.3 ...
2 days ago · Python integers are passed as the platform’s default C int type, their value is masked to fit into the C type. Before we move on calling functions with other parameter types, we have to learn more about ctypes data types.
3. Data model — Python 3.13.3 documentation
3 days ago · >>> # list has class "type" as its metaclass, like most classes: >>> type (list) <class 'type'> >>> type (dict) == type (list) == type (tuple) == type (str) == type (bytes) True >>> # "list[int]" calls "list.__class_getitem__(int)" >>> list [int] list[int] >>> # list.__class_getitem__ returns a GenericAlias object: >>> type (list [int]) <class ...
enum — Support for enumerations — Python 3.13.3 documentation
2 days ago · ReprEnum uses the repr() of Enum, but the str() of the mixed-in data type: int.__str__() for IntEnum and IntFlag. str.__str__() for StrEnum. Inherit from ReprEnum to keep the str() / format() of the mixed-in data type instead of using the Enum-default str().
Enum HOWTO — Python 3.13.3 documentation
2 days ago · Enum classes that are mixed with non-Enum types (such as int, str, etc.) are evaluated according to the mixed-in type’s rules; otherwise, all members evaluate as True. To make your own enum’s boolean evaluation depend …
5. Data Structures — Python 3.13.3 documentation
3 days ago · We saw that lists and strings have many common properties, such as indexing and slicing operations. They are two examples of sequence data types (see Sequence Types — list, tuple, range). Since Python is an evolving language, other sequence data types may be added. There is also another standard sequence data type: the tuple.