As others have said, this is the same result. Here is a more detailed example of how this syntax can be used:
blah.txt
1
2
3
4
5
I can open one file and write its contents to another file in a short way:
with open('blah.txt', 'r') as infile, open('foo.txt', 'w+') as outfile:
for line in infile:
outfile.write(str(line))
foo.txt now contains:
1
2
3
4
5
source
share