Hello, everyone
There was a problem when I created a data folder in the same location as the py file and tried to decompress all the compressed files in the data folder.
First of all, the coding I did is
import zipfile
file_path = './data/'
output_unzip = zipfile.ZipFile('./data/.zip', 'r')
output_unzip.extractall(file_path)
output_unzip.close()
I did it like this I think it'll work, but there's a path error.
FileNotFoundError: [Errno 2] No such file or directory: './data/.zip'
Is there any solution?
python
If you look at the path of the error message, you can see why. There are only paths and extensions, but there are no important file names. The path ./data/
does not contain a file named .zip
so I think it is an error.
In addition, to decompress all files in the data
folder, you must take the names of all .zip
files and repeat them so that they can be extracted from one file to another. I think this code will only run once in the specified file.
© 2024 OneMinuteCode. All rights reserved.