Trying to write a dictionary to a raw text file:
doc = {'foo':'bar'}
f = '/home/pi/Documents/samplefile.txt'
backup__file = open(f, 'a')
f.write(str(doc))
f.close
but getting the error str has no attribute write. How can I just dump a dictionary into a blank text file?