Python Cheatsheet

Python Cheatsheet

Python 3cheatsheet

One Liners

This is a list of some awesome one liners

Start local server

python -m http.server

Python 2:

python -m SimpleHTTPServer

It will start a local http server in current folder

python -m http.server 8081

This will start a http server on port 8081

Execute Python code lines in shell

python -c "python code"
python -c "print(2+2)"
python -c "print(2+2);print('Another line')"

Original: Updated: