You are viewing a single comment's thread from:
RE: Neat Python Feature - Pickle!
Beginner question:
with open('my_list.txt', 'wb') as fp:
Shouldn't this command create a file if it is not existing already?
Beginner question:
with open('my_list.txt', 'wb') as fp:
Shouldn't this command create a file if it is not existing already?
Yes but in most cases your scripts will attempt to read first so touching the file is just a precaution, obviously you can check for file existence in your code too and even prepare it with an empty array :)