Re: [Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread ZEMMOURA Khalil Zakaria
Thanks a lot. that helped me to understand that behaviour. Best regards. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread Ben Finney
ZEMMOURA Khalil Zakaria writes: > The file opened using open() is closed automaticaly after iterationg > over it in the python shell You can interrogate a file to ask whether it is closed; the ‘closed’ attribute will be True when the file is closed. > testfile = open('test.txt') > for line in t

Re: [Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread Peter Otten
ZEMMOURA Khalil Zakaria wrote: > Hi, > > I am playing with python3.6 and i noticed a change in the behaviour of the > open() builtin function. > > The file opened using open() is closed automaticaly after iterationg over > it in the python shell > > Here is the dummy code i am using: > > # Beg

[Tutor] file opened by open() are closed automaticaly

2017-01-14 Thread ZEMMOURA Khalil Zakaria
Hi, I am playing with python3.6 and i noticed a change in the behaviour of the open() builtin function. The file opened using open() is closed automaticaly after iterationg over it in the python shell Here is the dummy code i am using: # Beggin testfile = open('test.txt') for line in testfil