'I keep getting the error "[Errno 21] Is a directory:" when recalling a text file from a zipped file
I have a zipped file that I have unzipped that contains text files in the date format "yyyymmdd.txt" and when I try recalling a certain date's file I keep getting the error shown below.
Here is me unzipping the file:
import zipfile
with zipfile.ZipFile("ALL_FOMC_MINUTES_1990_2021.zip","r") as zip_ref:
zip_ref.extractall('20200315.text')
When I try cleaning the code and importing other text files they all work except for the "20200315" one
import re
def Text(filename):
f = open(filename, 'r')
text = f.read()
f.close()
return text
mainfile=Text('20200315.txt')
file1 =Text('1.6_LM_negative.txt')
file2=Text('1.6_LM_positive.txt')
file3=Text('StopWords_Generic.txt')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|