How to use 'save list to file python' in Python

Every line of 'save list to file python' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
3def save(file_, *args, **kwargs):
4 """
5 Save the value of some data in a file.
6 Usage: save('misdatos.pypic','a',b=b)
8 """
9 f=open(file_, "wb")
10 dict = kwargs
11 for name in args:
12 dict[name] = eval(name)
13 pickle.dump(dict, f, protocol=2)
14 f.close
32def save_output(fname, data):
33 with open(fname, 'w') as f:
34 f.writelines(data)

Related snippets