Skip to content

Instantly share code, notes, and snippets.

@soldair
Created July 7, 2013 15:10
Show Gist options
  • Save soldair/5943759 to your computer and use it in GitHub Desktop.
Save soldair/5943759 to your computer and use it in GitHub Desktop.
me learns pythons
// write a log file!
file = open(logname,'a+');
file.write("log line!\n");
// stringify json
import json
json.dumps("hi");
// stringify module to json and log it to a file!
import json
import {module}
log = open('/tmp/a','a+')
log.write({module}.__file__ + "\n")
log.write(json.dumps({module}.__dict__.keys()) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment