How can I read multiple txt file from a single folder in Python?
I tried with the following code but it is not working.
import glob
import errno
path = '/home/student/Desktop/thesis/ndtvnews/garbage'
files = glob.glob(path)
for name in files:
try:
with open(name) as f:
print name
for line in f:
print line,
f.close()
except IOError as exc:
if exc.errno != errno.EISDIR:
raise