Problem reading text files without extensions in python -
i have written piece of code supposed read texts inside several files located in directory. these files text files not have extensions.but code not able read them:
corpus_path = 'reviews/' infile in glob.glob(os.path.join(corpus_path,'*.*')): review_file = open(infile,'r').read() print review_file
to test if code works, put dummy text file, dummy.txt. worked because has extension. don't know should done files without extensions read. can me? thanks
just use *
instead of *.*
.
the latter requires extension present (more precisely, there needs dot in filename), former doesn't.
Comments
Post a Comment