On Tuesday 08 September 2009 17:22:30 Maggie wrote:
> My code is supposed to enumerate each line of file (1, 2, 3...) and
> write the new version into the output file --
>
> #!/usr/bin/python
>
> import os.path
> import csv
> import sys
>
> #name of output file
> filename = "OUTPUT.txt"
>
>
> #open the file
> test = open ("test.txt", "r")After this, do the following and see what you get: for i,line in enumerate(test.readlines()): print i, line > my question is why the enumeration starts and stops at first line and > doesnt go through the entire file -- It does - but it sees the entire file as one line, somehow. > (file is saved as .txt, so hypothetically no .rtf formatting that > would screw up the output should be present) If it is really text, and if there are newlines at the end of the lines, then it should JustWork... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
