comparison readfile.py @ 6:9ee84d9fd3a7 draft

Uploaded
author bernhardlutz
date Thu, 03 Apr 2014 06:50:57 -0400
parents 54358dfa62c0
children 3c1e862e8cd6
comparison
equal deleted inserted replaced
5:1ad356686717 6:9ee84d9fd3a7
1 #!/usr/bin/env python
2
3 import io
4 import urllib2, urllib, httplib
5 def getListFromFile(file):
6 idlist=[]
7 for line in file:
8 if int(line):
9 idlist.append(line.strip())
10 return idlist
11
12 def getresult(url):
13 try:
14 connection = urllib2.urlopen(url)
15 except urllib2.HTTPError, e:
16 return ""
17 else:
18 return connection.read().rstrip()
19