Im trying to grab a colum of data from a text file and write it to a new file. I am having trouble getting It to write the data to newlines. Python is making it one Long string without any spaces when it writes the file. The first character is capitalized in colum 2. I am trying to grab the 2nd colum in the file.
import sys, string inputfilenames, outputfilename = sys.argv[1:-1], sys.argv[-1] for inputfilename in inputfilenames: inputfile = open(inputfilename,'r') outputfile = open(outputfilename, "w") for ln in inputfile.readlines(): words = string.split(ln) if len(words) >= 2: # print (words[1]) outputfile.write(words[1]) When I use just print it prints out fine. Each on a dffrent line just the way I want it. But writing the file its all on one line. How do I get the data to goto new lines in the new file? Alex Nordhus Copy and Paste ! http://www.pasteaway.com -- http://mail.python.org/mailman/listinfo/python-list