On 2015-05-11 23:48, Peter Otten wrote:
Alex Kleider wrote:Is there a better (more 'Pythonic') way to do the following? for f_name in f_names: with open(f_name, 'r') as f: for line in f:There's the fileinput module <https://docs.python.org/dev/library/fileinput.html#fileinput.input> but personally I prefer the way you show above.
Then I'll stick with what you prefer and what I know. It seems silly to import yet another module for the sole purpose of saving one line of code although the reason for my inquiry was more to diminish levels of indentation than number of lines. Thanks, Alex _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
