Created
May 31, 2014 00:50
-
-
Save yuchan/8f636a414d01c5b4571d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib | |
import sys | |
import os | |
import subprocess | |
import re | |
seed = sys.argv | |
seed.pop(0) | |
sum = 0 | |
prog = re.compile('\d+') | |
for j in seed: | |
f = urllib.urlopen(j) | |
s = f.read() | |
f.close() | |
p = subprocess.Popen(['wc','-w'],stdin=subprocess.PIPE,stdout=subprocess.PIPE) | |
out, err = p.communicate(s) | |
pat = prog.search(out).group() | |
nint = int(pat) | |
sum += nint | |
print("Total %d" % (sum)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment