Hi there, This is a beginner question. I learned that
with open("foo.txt") as f: lines = f.readlines() using the with-construct is the recommended way to deal with files making sure that close() always happens. However, I also could do: lines = open("foo.txt").readlines() I have to admit that I'm not sure if in case something bad happens a close() is done implicitly as in the first example. Could I use the latter as a substitute for the with-construct? What are the recommendations of the experts? -- Thanks, Manfred -- https://mail.python.org/mailman/listinfo/python-list