I have a thread in which I am reading zip file with I know that Is there a way that I can read the file speed without memory error? Assume that you are trying to read a zipped text file, you can treat it An object like the file has been returned in the form of an iterator, and process it by line-by-line ... zipfile.ZipFile (). Read () , where I'm getting a memory error.
read () loads the entire file in memory, after unzipping, the file size is more than 100MB i with
zipfile.zipfile () Also tried ... Open (). Readlines () , but it takes a lot of time.
zipfile import from zipfile zip = zipfile ('myzip.zip ') Stream = Open to line in the ZIP stream (' myfile.txt '): do_something_with (line)
No comments:
Post a Comment