Posts

Wednesday, 13 September 2017

Python (with ~ as)



-------------------------------------------

f= open('test.txt','r')

    ...

f.close()

--------------------------------------------

with open('test.txt','r') as f:
    ...

--------------------------------------------



'with open() as ' close the file automatically after the code end.

[ new blog ]

new blog https://jihyo-jeon.github.io/