Yesterday I made little update to my function get_html_source() that gets the content of a page. I did so because I found that my previous function didn't support HTTP POST. Now the code supports both HTTP GET and HTTP POST. It also returns the cookiejar along with the html content of the page. def get_html_source(url, referer = '', data = 0, cj = 0, retry_counter = 0): if retry_counter > 0: print 'Trying Again...' if retry_counter > 3: print 'Could not get source from url:', url return '', '' try: if cj: opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) else: opener = urllib2.build_opener() opener.addheaders = [('Referer', referer), ('Content-Type', 'application/x-www-form-urlencoded'), ('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/200...
Comments
import sys
for line in sys.stdin:
# do whatever you want with line
Note that there is an extra newline character ("\n") after end of each line.
SAMPLE INPUT
3
1 1 1
3 5 6
2 1 2
how to take this input??
while t:
t = t - 1
s = raw_input()
n, a, d = s.split()
n = int(n)
a = int(a)
d = int (d)
n, a, d = [int(x) for x in raw_input().split()]
while t:
....t = t - 1
....s = raw_input()
....n, a, d = s.split()
N, A, D = map(int, raw_input().split())