How to count word from a zipped file which in gz format using python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to count word from a zipped file which in gz format using python?

15th Jun 2017, 8:16 PM
Abhishek Dubey
Abhishek Dubey - avatar
2 Answers
+ 5
A module called 'gzip' should handle this. It can read the file and return contents to you (text or binary). You can decompress and do a normal search loop, like you would do with a regular file on your desktop.
15th Jun 2017, 8:44 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
This gunzips a stream of gzipped bytes I typed into the program. It's not a full answer but it may help you use the gzip module. https://code.sololearn.com/cpl25LvQ3wvu/?ref=app
15th Jun 2017, 8:48 PM
Kirk Schafer
Kirk Schafer - avatar