Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- import gzip
- import io
- import subprocess
- def regular():
- i = 0
- with gzip.open("human_g1k_v37.fasta.gz") as f:
- for line in f:
- i += 1
- print(i)
- def buffered_gzip():
- i = 0
- gz_file = gzip.open("human_g1k_v37.fasta.gz")
- gz_file.read1 = gz_file.read
- with io.TextIOWrapper(gz_file) as f:
- for line in f:
- i += 1
- print(i)
- def zcat()
- i = 0
- p = subprocess.Popen(
- ["gzcat", "human_g1k_v37.fasta.gz"],
- stdout=subprocess.PIPE
- )
- for line in p.stdout:
- i += 1
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement