Skip to content

Instantly share code, notes, and snippets.

@mbrenig
Last active May 25, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbrenig/80e08cab8a8dae05e652a4011fac6703 to your computer and use it in GitHub Desktop.
Save mbrenig/80e08cab8a8dae05e652a4011fac6703 to your computer and use it in GitHub Desktop.
Python libraries demo
# https://pypi.python.org/pypi/python-dateutil/2.5.3
# https://dateutil.readthedocs.io/en/stable/
from dateutil import parser # pip install python-dateutil
if __name__ == '__main__':
try:
a = parser.parse("18 Aug 2001")
print a
b = parser.parse("2016-04-05 12:33:55")
print b
c = parser.parse("25th May 2016, 1pm")
print c
except ValueError, e:
print "Error parsing date: %s" % e
print (b - a).days
def myfunc(a, b):
import pdb;pdb.set_trace()
return a+b
if __name__ == '__main__':
print myfunc(1,2)
print myfunc(1, "2")
# python -m pdb pdbdemo.py
# https://pypi.python.org/pypi/pyperclip
import pyperclip # pip import pyperclip
if __name__ == '__main__':
text = "Some long block of text data."
pyperclip.copy(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment