On Mon, 2014-01-20 at 10:41 +0000, Oscar Benjamin wrote: […] > f = open('myfile.txt') > for line in f: > print(line.upper()) > f.close()
I suggest we even see this as not good code due to the possibility of I/O exceptions: with open('myfile.txt') as f: for line in f: print(line.upper()) should, I argue, be the canonical idiom in modern Python. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor