Urllib Examples





11.3.2 Examples
















Python Library Reference




Previous: 11.3.1 URLopener Objects
Up: 11.3 urllib
Next: 11.4 httplib




11.3.2 Examples



Here is an example session that uses the "GET" method to retrieve
a URL containing parameters:



>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
>>> print f.read()



The following example uses the "POST" method instead:



>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()







Python Library Reference




Previous: 11.3.1 URLopener Objects
Up: 11.3 urllib
Next: 11.4 httplib



See About this document... for information on suggesting changes.





Wyszukiwarka

Podobne podstrony:
general training example writing 6 10
Project manager CV example 1
Example01
group convolution example
drugs for youth via internet and the example of mephedrone tox lett 2011 j toxlet 2010 12 014
group matrix example
MSP430x13x, MSP430F14x, MSP430F15x, MSP430F16x Code Examples TI COM ?T140?molist C
pickle example
Source Program Information EXAMPLE
examples
examples ?cident records
The Social EconomyBR The dynamics of the social economyBR Example of Basta Arbetskooperativ
WiDaF test examples
installation example

więcej podobnych podstron