[Tutor] Errno 9
imonthejazz at googlemail.com
Thu Feb 28 15:36:55 CET 2008
I am trying to read a line in a file then split the words in the line up.
This is what i thought would work:
# THE FOLLOWING FOUR LINE ARE THE CORRECT START TO THE PROGRAM,
# THE SIXTH AND SEVENTH LINES ARE ONLY FOR QUICK TEST PURPOSE!!!
infilename = raw_input("What file would you like to re-arrange?: ")
outfilename = raw_input("Where would you like to save to array?: ")
infile = open(infilename, 'r')
infile = open(outfilename, 'w')
#infile = open("G:\gnet.nmap", 'r')
#infile = open("G:\work2.txt", 'w')
# process each line
for line in infile.readlines():
words = string.split(line)
# save and close files
But i get an "IO Error: [Errno 9] Bad file descriptor" on line 16.
Tried changing syntax and file names, thought it was fairly simple and i
knew what i was doing. Any help appreciated.
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor