Featured image of post Python Standard Library Cheatsheet

Python Standard Library Cheatsheet

Python Standard Library Cheatsheet

https://www.amazon.com/Python-Standard-Library-Nutshell-Handbooks/dp/0596000960

Python Standard Library Overview

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Python Standard Library
 ├── Built-in Functions
     └── Functions like print(), len(), range(), etc.
 ├── os
     ├── os.path
     ├── os.system
     └── os.environ
 ├── sys
     ├── sys.argv
     ├── sys.path
     └── sys.modules
 ├── datetime
     ├── datetime.datetime
     ├── datetime.date
     ├── datetime.time
     └── datetime.timedelta
 ├── json
     ├── json.load
     ├── json.dump
     ├── json.loads
     └── json.dumps
 ├── re
     ├── re.compile
     ├── re.search
     └── re.match
 ├── math
     ├── math.sqrt
     ├── math.sin
     ├── math.cos
     └── math.pi
 ├── collections
     ├── collections.Counter
     ├── collections.defaultdict
     └── collections.namedtuple
 ├── itertools
     ├── itertools.chain
     ├── itertools.cycle
     └── itertools.permutations
 └── urllib
      ├── urllib.request
      ├── urllib.parse
      └── urllib.error

Python Standard Library Cheatsheet

ModuleCommon Functions/ClassesDescription
osos.path, os.system(), os.environ, os.mkdir()Operating system interfaces
syssys.argv, sys.path, sys.modules, sys.exit()System-specific parameters and functions
datetimedatetime.datetime, datetime.date, datetime.time, datetime.timedeltaDate and time manipulation
jsonjson.load(), json.dump(), json.loads(), json.dumps()JSON serialization and deserialization
rere.compile(), re.search(), re.match(), re.findall(), re.sub()Regular expression operations
mathmath.sqrt(), math.sin(), math.cos(), math.pi, math.log()Mathematical functions
collectionscollections.Counter, collections.defaultdict, collections.namedtupleContainer datatypes
itertoolsitertools.chain(), itertools.cycle(), itertools.permutations(), itertools.combinations()Functions creating iterators
randomrandom.random(), random.randint(), random.choice(), random.shuffle()Generating random numbers
stringstring.ascii_letters, string.digits, string.punctuationCommon string operations and constants
urlliburllib.request, urllib.parse, urllib.errorURL handling modules
subprocesssubprocess.run(), subprocess.Popen(), subprocess.call()Subprocess management
shutilshutil.copy(), shutil.move(), shutil.rmtree(), shutil.disk_usage()High-level file operations
logginglogging.basicConfig(), logging.debug(), logging.info(), logging.error()Logging facility for Python
configparserconfigparser.ConfigParser(), configparser.read(), configparser.get()Configuration file parser
socketsocket.socket(), socket.bind(), socket.listen(), socket.accept()Low-level networking interface
threadingthreading.Thread(), threading.Lock(), threading.Event(), threading.Timer()Thread-based parallelism