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