Created
January 15, 2015 17:32
-
-
Save Kwpolska/f845da8b55056f5fb0fe to your computer and use it in GitHub Desktop.
with in for
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
files = ['foo', 'bar', 'baz'] | |
for fn in files: | |
with io.open(fn, 'r', encoding='utf-8') as fh: | |
print('file {0}:'.format(fn)) | |
print(fh.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment