Hello This is a newbie question.
I need to read a text file into a variable, loop through each line and use a regex to substitute some items within the line, and save the whole variable into a new text file. This triggers an error when I save the modified variable that contains all the lines: ================== import re,sys f = open("C:\\input.txt", "r") textlines = f.readlines() f.close() for line in textlines: #edit each line line = "just a test" #rewrite data to new file log = open('output.sub','w') #ERROR: argument 1 must be string or read-only character buffer, not list log.write(textlines) log.close() ================== Should I use another way to read the file, edit each line, and save the data into a new file? Thank you. -- http://mail.python.org/mailman/listinfo/python-list