Snippets

Posted by: barbara | Date: Feb 11, 2013 | Category:

Python

print line numbers in a Python script:

 import sys frame = sys._getframe() print frame.f_lineno 

Python - date from Unix timestamp

 import datetime print(datetime.datetime.fromtimestamp(int("1284101485")).strftime('%Y-%m-%d %H:%M:%S')) 

Django

get a list of all available subcommands:

 python manage.py help 

cmd line

...

Read More