Thanks very much Bvdet. I had to add a line after line 7:
f2.write(" ")
User Profile
Collapse
-
Remove line breaks from a BIG text file
I need to remove line breaks from a large ASCII table, but get a MemoryError. The data is an ASCII grid: the header takes up the first 6 lines followed by 22000 rows of data. I want to remove the line breaks from the table part of the file while leaving the first 6 line breaks. The following code works for small files but runs out of memory (at the 3rd line) for large files: (thanks to Zhaphod and Bvdet from an earlier post)
Code:f1 = open(fn1)
-
Remove line breaks from a text file
I have an ASCII table where each row is a line. I'd like to replace each line break with a space so that i end up with one very long row. Any ideas? Thanks!
No activity results to display
Show More
Leave a comment: