Affiliate link
Python - Data Types
The basic data types in Python.
| Name | Type | Mutable | Examples |
|---|---|---|---|
| Boolean | bool | No | True, False |
| Integer | int | No | 5, 10789, 10_789 |
| Float | float | No | 3.142, 1.5e2 |
| Complex | complex | No | 5j, 5 + 9j |
| String | str | No | 'learn python', "Learn Python",'''Learn
Python''' |
| List | list | Yes | ['Python', 'Node.js', 'GO'] |
| Tuple | tuple | No | (2, 5, 8) |
| Set | set | Yes | set([2, 5, 8]) |
| Frozen set | frozenset | No | frozenset([2, 5, 8]) |
| Bytes | bytes | No | (2, 5, 8) |
| Byte array | bytearray | Yes | set([2, 5, 8]) |
Single-line String
String literals can be enclosed with ' or "
var1 = 'This is a string.'Multiline String
Multiline string literals can be enclosed with ''' or """
var1 = '''This is a
multiline string.'''
var2 = """This is a
multiline string."""Affiliate link
Affiliate link




