Skip to content

Instantly share code, notes, and snippets.

@pankajparashar-zz
Created July 13, 2013 08:29
Show Gist options
  • Save pankajparashar-zz/5989983 to your computer and use it in GitHub Desktop.
Save pankajparashar-zz/5989983 to your computer and use it in GitHub Desktop.
# Python Help
python -h
# Calendar
python -m calendar
python -m calendar -h
python -m calendar 1999
# Zip and Gzip Tools
python -m zipfile -l pcblib.zip
python -m zipfile -e pcblib.zip
python -m zipfile -c release.zip *.py
python -m gzip -d mydata.tar.gz
# Pretty JSON Printer
python -m json.tool < mydata.json
# Unicode Characters
python -c "import unicodedata; print unicodedata.name(unichr(0x2249))"
python -c "print unichr(0x2249)"
# Web Servers
python -m SimpleHTTPServer
python -m CGIHTTPServer
python -m smtpd -n -c DebuggingServer localhost:8025
# Python Doc
python -m pydoc
python -m pydoc -k
# Python Debugger
python -m pdb
# Interactive profile statistics browser
python -m pstats
# String processing
python -c "import sys; print ''.join(x.capitalize() for x in sys.stdin)" < names.txt
# Numerical processing
python -c "import sys, math; print math.fsum(float(x) for x in sys.stdin)" < numbers.dat
# What is the easiest way to get a URL encoded password?
python -c 'from getpass import getpass; from urllib import quote; print quote(getpass("Proxy Password: "))'
# The Zen of Python
python -m this
python -c "import this"
# xkcd 353
python -c "import antigravity"
# Braces instead of whitespace
python -c "from __future__ import braces"
# A CS lecture
python -c "import heapq; print heapq.__about__"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment