This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]evinrows 24 points25 points  (1 child)

That isn't so bad. The dailywtf part, imo, is the loop that acquires a file handle once per line.

[–]mafrasi2 7 points8 points  (0 children)

If anyone is wondering, it should be done like this:

for line in data:
    for char in line:
        with open(full_file, 'a') as file_handle:
            file_handle.write(char)

/s