GNU/Linux.guru
Document thumbnail.
Download: [PDF|HTML|ConTEXt|GitHub]

Python

Set of interpreter: #!/usr/bin/env python
Comments: # everything behind hash
""" more lines comment """

Command line parameters

Create virtual environment

Expression statements

FOR cycle WHILE contition
for identifier in list :
␣␣␣␣list-processing code
[ else :
␣␣␣␣suite ]
while condition
␣␣␣␣repeat if condition is true
[ else:
␣␣␣␣suite ]
IF-THEN-ELSE TRY block
if condition :
␣␣␣␣true suite
[ elif condition:
␣␣␣␣else if true ]
[ else :
␣␣␣␣else suite ]
try:
␣␣␣␣possible runtime error
except [type [as value]]:
␣␣␣␣error-recovery code
[ else:
␣␣␣␣suite ]
[ finally:
␣␣␣␣suite ]

Classes

Functions

Variables

Constants

Operators

Data types

Function Tuple List Dict. String Set
Init. (,),tuple() [], list() , dict() "",'',str() , set()
clear
copy
count
index
pop
remove
update

Tuples

Lists

Dictionaries

Sets

Strings

Output and formating

String methods

Other built-in functions

Work with files

Regular expressions (import re)

System specific functions and parameters