Skip to main content


Showing posts from July, 2013

Cool Python Tricks

Print Append Using print to append string to file file = open('path/to/file','a+') print >> file, 'string to append' print >> file, 'another string'
If you check your file you should have string to append another string
Dictionary Functions Map functions in python dictionary def doThis(): print 'this' def doThat(): print 'that' def doThose(string): print string func_dict = { 'this':doThis, 'that':doThat, 'those':doThose } func_dict['this'] #prints this func_dict['that'] #prints that func_dict['those']('Python is cool') #prints Python is cool
More to come...