Every line of 'python save list to txt' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
60 def write_txt(str): 61 with open('answers_all.txt', 'a') as f: 62 f.write(str)
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
63 def write_txt(path, fname, contents, flag=False): 64 make_directory(path) 65 full_path = os.path.join(path,fname) 66 log = open(full_path, 'a') 67 log.write(contents + '\n') 68 log.close() 69 if (flag): 70 print '-> [%s] has been written in %s.' % (contents, fname)