TensorLearn
Back to Course
Python Essentials: The Engineering Approach
Module 16 of 20

16. The Cheatsheet

Environment

bash
python3 -m venv venv # Create Venv source venv/bin/activate # Activate pip install -r requirements.txt

Types

python
l = [1, 2] # List (Mutable) t = (1, 2) # Tuple (Immutable) s = {1, 2} # Set (Unique) d = {'k': 'v'} # Dict (Hash Map)

Comprehensions

python
[x for x in list] {k:v for k,v in dict.items()}

Classes

python
class MyClass(Parent): def __init__(self): super().__init__()

File I/O

python
with open('f.txt', 'r') as f: data = f.read()

Mark as Completed

TensorLearn - AI Engineering for Professionals