-1

For example, opening many text files with notepad++ via python script. I need to open every file in a directory.

1 Answers1

1

You can use the glob and fileinput together

import fileinput
from glob import glob

file = glob('Sample*.txt')
for line in fileinput.input(file):
    pass

If you want to iterate multiple files then use :

for x in fileinput.input(['patterns.in', 'sample*.txt']):
    print x
Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45