Creating a function for a directory
breamoreboy at yahoo.co.uk
Mon Nov 11 23:45:24 CET 2013
On 11/11/2013 22:26, Matt wrote:
> So I want to take the file, "desktop/test.txt" and write it to "desktop/newfolder/test.txt". I tried the below script, and it gave me: "IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'". Any suggestions would be great.
> def firstdev(file):
> in_file = open("desktop/%s.txt") % file
in_file = open("desktop/%s.txt" % file)
> indata = in_file.read()
> out_file = open("desktop/newfolder/%s.txt", 'w') % file
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
More information about the Python-list