I wrote a piece of code that should read texts inside several files that are in a directory. These files are mostly text files, but they do not have any extensions. But my code cannot read them:
corpus_path = 'Reviews/'
for infile in glob.glob(os.path.join(corpus_path,'*.*')):
review_file = open(infile,'r').read()
print review_file
To check if this code works, I put a dummy text file dummy.txt. which worked because it has an extension. But I do not know what to do so that files without extensions can be read. Can anybody help me? Thanks
source
share