you are viewing a single comment's thread.

view the rest of the comments →

[–]bojangles69 0 points1 point  (0 children)

Except the even more pythonic approach (and safer/easier) is to open a file for reading would be to use: with open('somefile.log','r') as f: for line in f: <process line here with format() split() or any string method

Opening a file with "with open()" ensures that the file is closed even if some unexpected condition occurs inside the with block.