How do I read text files within a zip file?
python, python-3.x
Solution
You can use the zipfile module like so:
zip = zipfile.ZipFile('test.zip')
file = zip.read('text1.txt')
Don't forget to import zipfile module: `import zipfile`
Problem
So say I have a zip file named "files.zip" it contains "text1.txt": ``` words ``` and "text2.txt": ``` other words ``` How do I tell python to open and read the text1.txt file? I know that usually to open a text file outside of a zip file I would just do this: ``` file = open('text1.txt','r') ```