I have a thread in which I am reading a zip file with zipfile.ZipFile().read(), where I am getting a memory error.
I am aware that read() loads the entire file into memory. The size of file after unzipping is more than 100MB. I also tried with zipfile.ZipFile().open().readlines(), but it takes too much time.
Is there any way that I can read the file with speed without getting memory error?
readlines()with nosizehintargument also reads the entire file into memory and builds a list of the lines. So it wouldn't reduce memory requirements, but rather increase them slightly. See Aya's answer.