I'm trying to get a list of files on python using glob, however it is returning zero.
the method goes:
def read(self,folders)
"folders" input contain the files needed to be looped through
I used
files = glob(folders)
I'm trying to get a list of files on python using glob, however it is returning zero.
the method goes:
def read(self,folders)
"folders" input contain the files needed to be looped through
I used
files = glob(folders)
One way you can do it, which yield the contents of each file in turn.
from glob import glob
class C:
def read(self, folders):
for file in glob(folders):
with open(file) as f:
yield f.read()