0

with open()

Can someone explain why "with open("myfile.txt", "r") as f:" has indentation and what the indentations can be used for?

2nd Jul 2017, 12:01 PM
Daan van IJcken
Daan van IJcken - avatar
1 Resposta
+ 2
To explicit where end use of 'with' statement, wich create a new scope... ending the scope will implicitly close the file...
2nd Jul 2017, 12:53 PM
visph
visph - avatar