Skip to content

Instantly share code, notes, and snippets.

@yuchan
Created May 31, 2014 00:50
Show Gist options
  • Save yuchan/8f636a414d01c5b4571d to your computer and use it in GitHub Desktop.
Save yuchan/8f636a414d01c5b4571d to your computer and use it in GitHub Desktop.
#! /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