12.07.2015 Views

Submitting Form Data

Submitting Form Data

Submitting Form Data

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Fetching Web Pages• Simple Algorithm takes a URL on the command line:• Fetch request an URL as parameter, before open connection• Open URL from request fetch• Do Loop to read data from server• Stop if all data already downloaded• Write out the data on the command lineimport sys, urllib2req = urllib2.Request(‘www.example.com’)fd = urllib2.urlopen(req)while 1:data = fd.read(1024)if not len(data):breaksys.stdout.write(data)4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!