Even has it’s own grimoire

Top-level script environment, __main__ etc

def main():
    doSomething()

if __name__ == "__main__":
    main()

Embedding in iOS

Split a list

L = [1,2,3,4,5,6,7,8]
C = 3
print [L:[i:i+C] for i in range(0, len(L), C)]

How to flatten a tuple

Python Image / Thumbnail Resize

See: http://www.pythonware.com/products/pil/index.htm

Basic XML DOM parsing

Common code for V2 & v3

For example

Port Forwarding

python_port_forwarding.py

HTTP Proxy

Chafifi

Useful code for detecting bit rot.

In Homebrew

brew install python3

ip3.8 install azure
Python has been installed as
  /usr/local/opt/python@3.8/bin/python3

You can install Python packages with
  /usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrc

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/usr/local/opt/python@3.8/lib"

For pkg-config to find python@3.8 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"