Reading does not create file, only writing does:
>>> f = open('newfile.txt','w+')
>>> import os
>>> print([ n for n in os.listdir('.') if n.startswith('new')])
['newfile.txt', 'new_top95_s.txt']
>>>
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
You have to run kode in same folder as 'newfile.txt' or you have to give correct path.
f = open('c:/somefolder/newfile.txt','r+')
I do not have a
file there, but I thought you created a file with the same code?
Or as tony mention read(r) dos not create a new file only write(w) dos that.
snippsat
Practically a Posting Shark
808 posts since Aug 2008
Reputation Points: 353
Solved Threads: 294