15 Aug
2018
15 Aug
'18
5:36 p.m.
On Aug 14 2018 12:59, Takashi Sakamoto wrote:
If you use Python 2.5 or later, you can use 'file()' instead of 'open()'. Furthermore, FILE object returned by 'file()' (or 'open()') supports 'iterator' and you have no need to call '.readlines()' anymore, thus:
> + with file(filename, "r") as f: > + for line in f: ...
Oops. The 'file()' is removed at Python 3.0[1]...
[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins
Regards
Takashi Sakamoto