Created
March 20, 2014 06:30
-
-
Save shirou/9658377 to your computer and use it in GitHub Desktop.
zcat vs gzip module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import gzip | |
def zcat(): | |
count = 0 | |
for line in sys.stdin: | |
count += 1 | |
print count | |
def direct(): | |
count = 0 | |
fn = sys.argv[1] | |
f = gzip.open(fn, 'rb') | |
for line in f.readlines(): | |
count += 1 | |
print count | |
#zcat() | |
direct() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment