f = open('myfile.txt') for line in iter(f): print line f.close()
However, the format that it needs to be called in is like this:
As you can see, the method does not accept any parameters. However, the open statement inside the method needs to know what the filename is! How can I get filename from filename.myOpenFunction() into the method?