Show Menu
Cheatography

Python (Lucian) Cheat Sheet (DRAFT) by

Python

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Debugging

import pdb
Import debugger
python -m pdb myscri­pt.py
Invoking as script (post-­mortem debugging)
pdb.run('func()')
Call function in debugging mode
pdb.se­t_t­race()
Set breakpoint in code
s
step
n
next line
c
continue (until breakp­oint)
p expr
evaluate expression
!statement
execute statement
q
quit debugger
   

SAP Proxy for Urllib2

proxy_support = urllib2.ProxyHandler({'http': 'http://proxy.wdf.sap.corp:8080/'})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)