There are few modes to open file (read, write etc..)
If you want to read from file you should type file = open("File.txt","r")
, if write than file = open("File.txt","w")
. You need to give the right permission regarding your usage.
more modes:
- r. Opens a file for reading only.
- rb. Opens a file for reading only in binary format.
- r+ Opens a file for both reading and writing.
- rb+ Opens a file for both reading and writing in binary format.
- w. Opens a file for writing only.
- you can find more modes in here