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...
Comments
Post a Comment