def func(): with open('file1.txt') as used, open('file2.txt'): print(used)