On Sat, 05 Jun 2010 00:53:23 -0700, Steve wrote: > I am new to Python and am wanting to replace characters in a very large > text file.....6 GB > In plain language what I wish to do is: > > Remove all comma's > Replace all @ with comma's > Save as a new file.
input_file = open("some_huge_file.txt", "r") output_file = open("newfilename.txt", "w") for line in input_file: line = line.replace(",", "") line = line.replace("@", ",") output_file.write(line) output_file.close() input_file.close() -- Steve -- http://mail.python.org/mailman/listinfo/python-list