hello, here is an idiom (from the documentation) that you can use instead of your fh.readlines(): with open("hello.txt") as f: for line in f: print line