with open(filename, 'w') as f: f.write(data)