码迷,mamicode.com
首页 > 编程语言 > 详细

python urllib模块

时间:2017-02-17 11:09:25      阅读:1475      评论:0      收藏:0      [点我收藏+]

标签:prot   soft   design   viewport   cleanup   favicon   als   amp   follow   

1.urllib.urlopen(url[,data[,proxies]])

打开一个url的方法,返回一个文件对象,然后可以进行类似文件对象的操作。本例试着打开google

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.urlopen("http://www.baidu.com")
5 f = response.readline() #读取html第一行
6 print f
代码

返回结果

<!DOCTYPE html>

 

urlopen返回对象提供方法:

-         read() , readline() ,readlines() , fileno() , close() :这些方法的使用方式与文件对象完全一样

-         info():返回一个httplib.HTTPMessage对象,表示远程服务器返回的头信息

-         getcode():返回Http状态码。如果是http请求,200请求成功完成;404网址未找到

-         geturl():返回请求的url

 

2.urllib.urlretrieve(url[,filename[,reporthook[,data]]])

urlretrieve方法将url定位到的html文件下载到你本地的硬盘中。如果不指定filename,则会存为临时文件。

urlretrieve()返回一个二元组(filename,mine_hdrs)

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.urlretrieve("http://www.baidu.com")
5 print type(response)
6 print response[0]
7 print response[1]
临时存放 代码
技术分享
 1 <type tuple>
 2 /tmp/tmp8eVLjq
 3 Date: Fri, 17 Feb 2017 02:44:05 GMT
 4 Content-Type: text/html; charset=utf-8
 5 Connection: Close
 6 Vary: Accept-Encoding
 7 Set-Cookie: BAIDUID=2B910536110C34E39F7A5D0F0BB0AB8F:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
 8 Set-Cookie: BIDUPSID=2B910536110C34E39F7A5D0F0BB0AB8F; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
 9 Set-Cookie: PSTM=1487299445; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
10 Set-Cookie: BDSVRTM=0; path=/
11 Set-Cookie: BD_HOME=0; path=/
12 Set-Cookie: H_PS_PSSID=22104_1420_21124_17001_22035; path=/; domain=.baidu.com
13 P3P: CP=" OTI DSP COR IVA OUR IND COM "
14 Cache-Control: private
15 Cxy_all: baidu+90e29a03609778c29a3b33c9fc46b4a8
16 Expires: Fri, 17 Feb 2017 02:43:31 GMT
17 X-Powered-By: HPHP
18 Server: BWS/1.1
19 X-UA-Compatible: IE=Edge,chrome=1
20 BDPAGETYPE: 1
21 BDQID: 0xdff2399600011aec
22 BDUSERID: 0
返回结果

 

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.urlretrieve("http://www.baidu.com",filename=E:\google.html)
5 print type(response)
6 print response[0]
7 print response[1]
本地存放 代码
技术分享
 1 <type tuple>
 2 E:\google.html
 3 Date: Fri, 17 Feb 2017 02:48:06 GMT
 4 Content-Type: text/html; charset=utf-8
 5 Connection: Close
 6 Vary: Accept-Encoding
 7 Set-Cookie: BAIDUID=3DFE41A42CB005F34AE8BDEF4659A56D:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
 8 Set-Cookie: BIDUPSID=3DFE41A42CB005F34AE8BDEF4659A56D; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
 9 Set-Cookie: PSTM=1487299686; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
10 Set-Cookie: BDSVRTM=0; path=/
11 Set-Cookie: BD_HOME=0; path=/
12 Set-Cookie: H_PS_PSSID=1457_21112_18559_22036; path=/; domain=.baidu.com
13 P3P: CP=" OTI DSP COR IVA OUR IND COM "
14 Cache-Control: private
15 Cxy_all: baidu+871f7c77ae8fbab47caa28ffbda301bf
16 Expires: Fri, 17 Feb 2017 02:47:14 GMT
17 X-Powered-By: HPHP
18 Server: BWS/1.1
19 X-UA-Compatible: IE=Edge,chrome=1
20 BDPAGETYPE: 1
21 BDQID: 0xc583a986000127e2
22 BDUSERID: 0
返回结果

 

3.urllib.urlcleanup()

清除由于urllib.urlretrieve()所产生的缓存

 

4.urllib.quote(url)和urllib.quote_plus(url)

将url数据获取之后,并将其编码,从而适用与URL字符串中,使其能被打印和被web服务器接受。

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.quote("http://www.baidu.com")
5 res = urllib.quote_plus(http://www.baidu.com)
6 
7 print response
8 print res
代码
技术分享
1 http%3A//www.baidu.com
2 http%3A%2F%2Fwww.baidu.com
返回结果

 

5.urllib.unquote(url)和urllib.unquote_plus(url)

与4的函数相反。

 

6.urllib.urlencode(query)

将URL中的键值对以连接符&划分

这里可以与urlopen结合以实现post方法和get方法:

GET方法:

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.urlencode({orange:1,apple:2,eggs:3})
5 res = urllib.urlopen("http://python.org/query?%s" % response)
6 
7 print response
8 print res.read()
代码
技术分享
  1 orange=1&eggs=3&apple=2
  2 <!doctype html>
  3 <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
  4 <!--[if IE 7]>      <html class="no-js ie7 lt-ie8 lt-ie9">          <![endif]-->
  5 <!--[if IE 8]>      <html class="no-js ie8 lt-ie9">                 <![endif]-->
  6 <!--[if gt IE 8]><!--><html class="no-js" lang="en" dir="ltr">  <!--<![endif]-->
  7 
  8 <head>
  9     <meta charset="utf-8">
 10     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 11 
 12     <link rel="prefetch" href="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
 13 
 14     <meta name="application-name" content="Python.org">
 15     <meta name="msapplication-tooltip" content="The official home of the Python Programming Language">
 16     <meta name="apple-mobile-web-app-title" content="Python.org">
 17     <meta name="apple-mobile-web-app-capable" content="yes">
 18     <meta name="apple-mobile-web-app-status-bar-style" content="black">
 19 
 20     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 21     <meta name="HandheldFriendly" content="True">
 22     <meta name="format-detection" content="telephone=no">
 23     <meta http-equiv="cleartype" content="on">
 24     <meta http-equiv="imagetoolbar" content="false">
 25 
 26     <script src="/static/js/libs/modernizr.js"></script>
 27 
 28     <link href="/static/stylesheets/style.css" rel="stylesheet" type="text/css" title="default" />
 29     <link href="/static/stylesheets/mq.css" rel="stylesheet" type="text/css" media="not print, braille, embossed, speech, tty" />
 30     
 31 
 32     <!--[if (lte IE 8)&(!IEMobile)]>
 33     <link href="/static/stylesheets/no-mq.css" rel="stylesheet" type="text/css" media="screen" />
 34     
 35     
 36     <![endif]-->
 37 
 38     
 39     <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
 40     <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/apple-touch-icon-144x144-precomposed.png">
 41     <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/apple-touch-icon-114x114-precomposed.png">
 42     <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/apple-touch-icon-72x72-precomposed.png">
 43     <link rel="apple-touch-icon-precomposed" href="/static/apple-touch-icon-precomposed.png">
 44     <link rel="apple-touch-icon" href="/static/apple-touch-icon-precomposed.png">
 45 
 46     
 47     <meta name="msapplication-TileImage" content="/static/metro-icon-144x144-precomposed.png"><!-- white shape -->
 48     <meta name="msapplication-TileColor" content="#3673a5"><!-- python blue -->
 49     <meta name="msapplication-navbutton-color" content="#3673a5">
 50 
 51     <title>Welcome to Python.org</title>
 52 
 53     <meta name="description" content="The official home of the Python Programming Language">
 54     <meta name="keywords" content="Python programming language object oriented web free open source software license documentation download community">
 55 
 56     
 57     <meta property="og:type" content="website">
 58     <meta property="og:site_name" content="Python.org">
 59     <meta property="og:title" content="Welcome to Python.org">
 60     <meta property="og:description" content="The official home of the Python Programming Language">
 61     
 62     <meta property="og:image" content="https://www.python.org/static/opengraph-icon-200x200.png">
 63     <meta property="og:image:secure_url" content="https://www.python.org/static/opengraph-icon-200x200.png">
 64     
 65     <meta property="og:url" content="https://www.python.org/query?orange=1&amp;eggs=3&amp;apple=2">
 66 
 67     <link rel="author" href="/static/humans.txt">
 68 
 69     
 70 
 71     
 72     <script type="application/ld+json">
 73      {
 74        "@context": "http://schema.org",
 75        "@type": "WebSite",
 76        "url": "https://www.python.org/",
 77        "potentialAction": {
 78          "@type": "SearchAction",
 79          "target": "https://www.python.org/search/?q={search_term_string}",
 80          "query-input": "required name=search_term_string"
 81        }
 82      }
 83     </script>
 84 
 85     
 86     <script type="text/javascript">
 87     var _gaq = _gaq || [];
 88     _gaq.push([_setAccount, UA-39055973-1]);
 89     _gaq.push([_trackPageview]);
 90 
 91     (function() {
 92         var ga = document.createElement(script); ga.type = text/javascript; ga.async = true;
 93         ga.src = (https: == document.location.protocol ? https://ssl : http://www) + .google-analytics.com/ga.js;
 94         var s = document.getElementsByTagName(script)[0]; s.parentNode.insertBefore(ga, s);
 95     })();
 96     </script>
 97     
 98 </head>
 99 
100 <body class="python default-page fourohfour">
101 
102     <div id="touchnav-wrapper">
103 
104         <div id="nojs" class="do-not-print">
105             <p><strong>Notice:</strong> While Javascript is not essential for this website, your interaction with the content will be limited. Please turn Javascript on for the full experience. </p>
106         </div>
107 
108         <!--[if lt IE 8]>
109         <div id="oldie-warning" class="do-not-print">
110             <p><strong>Notice:</strong> Your browser is <em>ancient</em> and <a href="http://www.ie6countdown.com/">Microsoft agrees</a>. <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience a better web.</p>
111         </div>
112         <![endif]-->
113 
114         <!-- Sister Site Links -->
115         <div id="top" class="top-bar do-not-print">
116 
117             <nav class="meta-navigation container" role="navigation">
118 
119                 
120                 <div class="skip-link screen-reader-text">
121                     <a href="#content" title="Skip to content">Skip to content</a>
122                 </div>
123 
124                 
125                 <a id="close-python-network" class="jump-link" href="#python-network" aria-hidden="true">
126                     <span aria-hidden="true" class="icon-arrow-down"><span>&#9660;</span></span> Close
127                 </a>
128 
129                 
130 
131 <ul class="menu" role="tree">
132     
133     <li class="python-meta ">
134         <a href="/" title="The Python Programming Language" >Python</a>
135     </li>
136     
137     <li class="psf-meta ">
138         <a href="/psf-landing/" title="The Python Software Foundation" >PSF</a>
139     </li>
140     
141     <li class="docs-meta ">
142         <a href="https://docs.python.org" title="Python Documentation" >Docs</a>
143     </li>
144     
145     <li class="pypi-meta ">
146         <a href="https://pypi.python.org/" title="Python Package Index" >PyPI</a>
147     </li>
148     
149     <li class="jobs-meta ">
150         <a href="/jobs/" title="Python Job Board" >Jobs</a>
151     </li>
152     
153     <li class="shop-meta ">
154         <a href="/community/" title="Python Community" >Community</a>
155     </li>
156     
157 </ul>
158 
159 
160                 <a id="python-network" class="jump-link" href="#top" aria-hidden="true">
161                     <span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> The Python Network
162                 </a>
163 
164             </nav>
165 
166         </div>
167 
168         <!-- Header elements -->
169         <header class="main-header" role="banner">
170             <div class="container">
171 
172                 <h1 class="site-headline">
173                     <a href="/"><img class="python-logo" src="/static/img/python-logo.png" alt="python&trade;"></a>
174                 </h1>
175 
176                 <div class="options-bar do-not-print">
177 
178                     
179                     <a id="site-map-link" class="jump-to-menu" href="#site-map"><span class="menu-icon">&equiv;</span> Menu</a><form class="search-the-site" action="/search/" method="get">
180                         <fieldset title="Search Python.org">
181 
182                             <span aria-hidden="true" class="icon-search"></span>
183 
184                             <label class="screen-reader-text" for="id-search-field">Search This Site</label>
185                             <input id="id-search-field" name="q" type="search" role="textbox" class="search-field" placeholder="Search" value="" tabindex="1">
186 
187                             <button type="submit" name="submit" id="submit" class="search-button" title="Submit this Search" tabindex="3">
188                                 GO
189                             </button>
190 
191                             
192                             <!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" tabindex="4"><![endif]-->
193 
194                         </fieldset>
195                     </form><span class="breaker"></span><div class="adjust-font-size" aria-hidden="true">
196                         <ul class="navigation menu" aria-label="Adjust Text Size on Page">
197                             <li class="tier-1 last" aria-haspopup="true">
198                                 <a href="#" class="action-trigger"><strong><small>A</small> A</strong></a>
199                                 <ul class="subnav menu">
200                                     <li class="tier-2 element-1" role="treeitem"><a class="text-shrink" title="Make Text Smaller" href="javascript:;">Smaller</a></li>
201                                     <li class="tier-2 element-2" role="treeitem"><a class="text-grow" title="Make Text Larger" href="javascript:;">Larger</a></li>
202                                     <li class="tier-2 element-3" role="treeitem"><a class="text-reset" title="Reset any font size changes I have made" href="javascript:;">Reset</a></li>
203                                 </ul>
204                             </li>
205                         </ul>
206                     </div><div class="winkwink-nudgenudge">
207                         <ul class="navigation menu" aria-label="Social Media Navigation">
208                             <li class="tier-1 last" aria-haspopup="true">
209                                 <a href="#" class="action-trigger">Socialize</a>
210                                 <ul class="subnav menu">
211                                     <li class="tier-2 element-1" role="treeitem"><a href="http://plus.google.com/+Python"><span aria-hidden="true" class="icon-google-plus"></span>Google+</a></li>
212                                     <li class="tier-2 element-2" role="treeitem"><a href="http://www.facebook.com/pythonlang?fref=ts"><span aria-hidden="true" class="icon-facebook"></span>Facebook</a></li>
213                                     <li class="tier-2 element-3" role="treeitem"><a href="http://twitter.com/ThePSF"><span aria-hidden="true" class="icon-twitter"></span>Twitter</a></li>
214                                     <li class="tier-2 element-4" role="treeitem"><a href="/community/irc/"><span aria-hidden="true" class="icon-freenode"></span>Chat on IRC</a></li>
215                                 </ul>
216                             </li>
217                         </ul>
218                     </div><div class="account-signin">
219                         <ul class="navigation menu" aria-label="Social Media Navigation">
220                             <li class="tier-1 last" aria-haspopup="true">
221                                 
222                                 <a href="/accounts/login/" title="Sign Up or Sign In to Python.org">Sign In</a>
223                                 <ul class="subnav menu">
224                                     <li class="tier-2 element-1" role="treeitem"><a href="/accounts/signup/">Sign Up / Register</a></li>
225                                     <li class="tier-2 element-2" role="treeitem"><a href="/accounts/login/">Sign In</a></li>
226                                 </ul>
227                                 
228                             </li>
229                         </ul>
230                     </div>
231 
232                 </div><!-- end options-bar -->
233 
234                 <nav id="mainnav" class="python-navigation main-navigation do-not-print" role="navigation">
235                     
236                         
237 <ul class="navigation menu" role="menubar" aria-label="Main Navigation">
238   
239     
240     
241     <li id="about" class="tier-1 element-1  " aria-haspopup="true">
242         <a href="/about/" title="" class="">About</a>
243         
244             
245 
246 <ul class="subnav menu" role="menu" aria-hidden="true">
247     
248         <li class="tier-2 element-1" role="treeitem"><a href="/about/apps/" title="">Applications</a></li>
249     
250         <li class="tier-2 element-2" role="treeitem"><a href="/about/quotes/" title="">Quotes</a></li>
251     
252         <li class="tier-2 element-3" role="treeitem"><a href="/about/gettingstarted/" title="">Getting Started</a></li>
253     
254         <li class="tier-2 element-4" role="treeitem"><a href="/about/help/" title="">Help</a></li>
255     
256         <li class="tier-2 element-5" role="treeitem"><a href="http://brochure.getpython.info/" title="">Python Brochure</a></li>
257     
258 </ul>
259 
260         
261     </li>
262     
263     
264     
265     <li id="downloads" class="tier-1 element-2  " aria-haspopup="true">
266         <a href="/downloads/" title="" class="">Downloads</a>
267         
268             
269 
270 <ul class="subnav menu" role="menu" aria-hidden="true">
271     
272         <li class="tier-2 element-1" role="treeitem"><a href="/downloads/" title="">All releases</a></li>
273     
274         <li class="tier-2 element-2" role="treeitem"><a href="/downloads/source/" title="">Source code</a></li>
275     
276         <li class="tier-2 element-3" role="treeitem"><a href="/downloads/windows/" title="">Windows</a></li>
277     
278         <li class="tier-2 element-4" role="treeitem"><a href="/downloads/mac-osx/" title="">Mac OS X</a></li>
279     
280         <li class="tier-2 element-5" role="treeitem"><a href="/download/other/" title="">Other Platforms</a></li>
281     
282         <li class="tier-2 element-6" role="treeitem"><a href="https://docs.python.org/3/license.html" title="">License</a></li>
283     
284         <li class="tier-2 element-7" role="treeitem"><a href="/download/alternatives" title="">Alternative Implementations</a></li>
285     
286 </ul>
287 
288         
289     </li>
290     
291     
292     
293     <li id="documentation" class="tier-1 element-3  " aria-haspopup="true">
294         <a href="/doc/" title="" class="">Documentation</a>
295         
296             
297 
298 <ul class="subnav menu" role="menu" aria-hidden="true">
299     
300         <li class="tier-2 element-1" role="treeitem"><a href="/doc/" title="">Docs</a></li>
301     
302         <li class="tier-2 element-2" role="treeitem"><a href="/doc/av" title="">Audio/Visual Talks</a></li>
303     
304         <li class="tier-2 element-3" role="treeitem"><a href="https://wiki.python.org/moin/BeginnersGuide" title="">Beginner&#39;s Guide</a></li>
305     
306         <li class="tier-2 element-4" role="treeitem"><a href="https://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
307     
308         <li class="tier-2 element-5" role="treeitem"><a href="https://docs.python.org/faq/" title="">FAQ</a></li>
309     
310         <li class="tier-2 element-6" role="treeitem"><a href="http://wiki.python.org/moin/Languages" title="">Non-English Docs</a></li>
311     
312         <li class="tier-2 element-7" role="treeitem"><a href="http://python.org/dev/peps/" title="">PEP Index</a></li>
313     
314         <li class="tier-2 element-8" role="treeitem"><a href="https://wiki.python.org/moin/PythonBooks" title="">Python Books</a></li>
315     
316 </ul>
317 
318         
319     </li>
320     
321     
322     
323     <li id="community" class="tier-1 element-4  " aria-haspopup="true">
324         <a href="/community/" title="" class="">Community</a>
325         
326             
327 
328 <ul class="subnav menu" role="menu" aria-hidden="true">
329     
330         <li class="tier-2 element-1" role="treeitem"><a href="/community/diversity/" title="">Diversity</a></li>
331     
332         <li class="tier-2 element-2" role="treeitem"><a href="/community/irc/" title="">IRC</a></li>
333     
334         <li class="tier-2 element-3" role="treeitem"><a href="/community/lists/" title="">Mailing Lists</a></li>
335     
336         <li class="tier-2 element-4" role="treeitem"><a href="/community/workshops/" title="">Python Conferences</a></li>
337     
338         <li class="tier-2 element-5" role="treeitem"><a href="/community/sigs/" title="">Special Interest Groups</a></li>
339     
340         <li class="tier-2 element-6" role="treeitem"><a href="https://wiki.python.org/moin/" title="">Python Wiki</a></li>
341     
342         <li class="tier-2 element-7" role="treeitem"><a href="/community/logos/" title="">Python Logo</a></li>
343     
344         <li class="tier-2 element-8" role="treeitem"><a href="/community/merchandise/" title="">Merchandise</a></li>
345     
346         <li class="tier-2 element-9" role="treeitem"><a href="/community/awards" title="">Community Awards</a></li>
347     
348 </ul>
349 
350         
351     </li>
352     
353     
354     
355     <li id="success-stories" class="tier-1 element-5  " aria-haspopup="true">
356         <a href="/about/success/" title="success-stories" class="">Success Stories</a>
357         
358             
359 
360 <ul class="subnav menu" role="menu" aria-hidden="true">
361     
362         <li class="tier-2 element-1" role="treeitem"><a href="/about/success/#arts" title="">Arts</a></li>
363     
364         <li class="tier-2 element-2" role="treeitem"><a href="/about/success/#business" title="">Business</a></li>
365     
366         <li class="tier-2 element-3" role="treeitem"><a href="/about/success/#education" title="">Education</a></li>
367     
368         <li class="tier-2 element-4" role="treeitem"><a href="/about/success/#engineering" title="">Engineering</a></li>
369     
370         <li class="tier-2 element-5" role="treeitem"><a href="/about/success/#government" title="">Government</a></li>
371     
372         <li class="tier-2 element-6" role="treeitem"><a href="/about/success/#scientific" title="">Scientific</a></li>
373     
374         <li class="tier-2 element-7" role="treeitem"><a href="/about/success/#software-development" title="">Software Development</a></li>
375     
376 </ul>
377 
378         
379     </li>
380     
381     
382     
383     <li id="news" class="tier-1 element-6  " aria-haspopup="true">
384         <a href="/blogs/" title="News from around the Python world" class="">News</a>
385         
386             
387 
388 <ul class="subnav menu" role="menu" aria-hidden="true">
389     
390         <li class="tier-2 element-1" role="treeitem"><a href="/blogs/" title="Python Insider Blog Posts">Python News</a></li>
391     
392         <li class="tier-2 element-2" role="treeitem"><a href="http://planetpython.org/" title="Planet Python">Community News</a></li>
393     
394         <li class="tier-2 element-3" role="treeitem"><a href="http://pyfound.blogspot.com/" title="PSF Blog">PSF News</a></li>
395     
396         <li class="tier-2 element-4" role="treeitem"><a href="http://pycon.blogspot.com/" title="PyCon Blog">PyCon News</a></li>
397     
398 </ul>
399 
400         
401     </li>
402     
403     
404     
405     <li id="events" class="tier-1 element-7  " aria-haspopup="true">
406         <a href="/events/" title="" class="">Events</a>
407         
408             
409 
410 <ul class="subnav menu" role="menu" aria-hidden="true">
411     
412         <li class="tier-2 element-1" role="treeitem"><a href="/events/python-events" title="">Python Events</a></li>
413     
414         <li class="tier-2 element-2" role="treeitem"><a href="/events/python-user-group/" title="">User Group Events</a></li>
415     
416         <li class="tier-2 element-3" role="treeitem"><a href="/events/python-events/past/" title="">Python Events Archive</a></li>
417     
418         <li class="tier-2 element-4" role="treeitem"><a href="/events/python-user-group/past/" title="">User Group Events Archive</a></li>
419     
420         <li class="tier-2 element-5" role="treeitem"><a href="https://wiki.python.org/moin/PythonEventsCalendar#Submitting_an_Event" title="">Submit an Event</a></li>
421     
422 </ul>
423 
424         
425     </li>
426     
427     
428     
429     
430   
431 </ul>
432 
433                     
434                 </nav>
435 
436                 <div class="header-banner "> <!-- for optional "do-not-print" class -->
437                     
438                     
439                 </div>
440 
441                 
442                 
443 
444              </div><!-- end .container -->
445         </header>
446 
447         <div id="content" class="content-wrapper">
448             <!-- Main Content Column -->
449             <div class="container">
450 
451                 <section class="main-content " role="main">
452 
453                     
454                     
455 
456                     
457 
458                     
459     
460     <article class="text">
461             
462         <h1 class="giga">Error 404: File not Found</h1>
463         
464         <p>We couldn&rsquo;t find what you were looking for. This error has been reported and we will look into it shortly. For now,</p>
465 
466         <ul>
467             <li>Try using the search box.</li>
468             <li>
469                 Python.org went through a redesign and you may have followed a broken link.
470                 Sorry for that, see if <a href="http://legacy.python.org/query">the same page on the legacy website</a> works.
471             </li>
472             <li>
473                 Lost in an exotic function call? Read <a href="/doc/">the docs</a>.
474                 Looking for a package? Check the <a href="https://pypi.python.org/">Package Index</a>.
475                 Need a specific version of Python? The <a href="/downloads/">downloads section</a> has it.
476             </li>
477         </ul>
478         
479     </article>
480     
481 
482 
483                 </section>
484 
485                 
486                 
487 
488                 
489                 
490 
491 
492             </div><!-- end .container -->
493         </div><!-- end #content .content-wrapper -->
494 
495         <!-- Footer and social media list -->
496         <footer id="site-map" class="main-footer" role="contentinfo">
497             <div class="main-footer-links">
498                 <div class="container">
499 
500                     
501                     <a id="back-to-top-1" class="jump-link" href="#python-network"><span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> Back to Top</a>
502 
503                     
504 
505 <ul class="sitemap navigation menu do-not-print" role="tree" id="container">
506     
507     <li class="tier-1 element-1">
508         <a href="/about/" >About</a>
509         
510             
511 
512 <ul class="subnav menu">
513     
514         <li class="tier-2 element-1" role="treeitem"><a href="/about/apps/" title="">Applications</a></li>
515     
516         <li class="tier-2 element-2" role="treeitem"><a href="/about/quotes/" title="">Quotes</a></li>
517     
518         <li class="tier-2 element-3" role="treeitem"><a href="/about/gettingstarted/" title="">Getting Started</a></li>
519     
520         <li class="tier-2 element-4" role="treeitem"><a href="/about/help/" title="">Help</a></li>
521     
522         <li class="tier-2 element-5" role="treeitem"><a href="http://brochure.getpython.info/" title="">Python Brochure</a></li>
523     
524 </ul>
525 
526         
527     </li>
528     
529     <li class="tier-1 element-2">
530         <a href="/downloads/" >Downloads</a>
531         
532             
533 
534 <ul class="subnav menu">
535     
536         <li class="tier-2 element-1" role="treeitem"><a href="/downloads/" title="">All releases</a></li>
537     
538         <li class="tier-2 element-2" role="treeitem"><a href="/downloads/source/" title="">Source code</a></li>
539     
540         <li class="tier-2 element-3" role="treeitem"><a href="/downloads/windows/" title="">Windows</a></li>
541     
542         <li class="tier-2 element-4" role="treeitem"><a href="/downloads/mac-osx/" title="">Mac OS X</a></li>
543     
544         <li class="tier-2 element-5" role="treeitem"><a href="/download/other/" title="">Other Platforms</a></li>
545     
546         <li class="tier-2 element-6" role="treeitem"><a href="https://docs.python.org/3/license.html" title="">License</a></li>
547     
548         <li class="tier-2 element-7" role="treeitem"><a href="/download/alternatives" title="">Alternative Implementations</a></li>
549     
550 </ul>
551 
552         
553     </li>
554     
555     <li class="tier-1 element-3">
556         <a href="/doc/" >Documentation</a>
557         
558             
559 
560 <ul class="subnav menu">
561     
562         <li class="tier-2 element-1" role="treeitem"><a href="/doc/" title="">Docs</a></li>
563     
564         <li class="tier-2 element-2" role="treeitem"><a href="/doc/av" title="">Audio/Visual Talks</a></li>
565     
566         <li class="tier-2 element-3" role="treeitem"><a href="https://wiki.python.org/moin/BeginnersGuide" title="">Beginner&#39;s Guide</a></li>
567     
568         <li class="tier-2 element-4" role="treeitem"><a href="https://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
569     
570         <li class="tier-2 element-5" role="treeitem"><a href="https://docs.python.org/faq/" title="">FAQ</a></li>
571     
572         <li class="tier-2 element-6" role="treeitem"><a href="http://wiki.python.org/moin/Languages" title="">Non-English Docs</a></li>
573     
574         <li class="tier-2 element-7" role="treeitem"><a href="http://python.org/dev/peps/" title="">PEP Index</a></li>
575     
576         <li class="tier-2 element-8" role="treeitem"><a href="https://wiki.python.org/moin/PythonBooks" title="">Python Books</a></li>
577     
578 </ul>
579 
580         
581     </li>
582     
583     <li class="tier-1 element-4">
584         <a href="/community/" >Community</a>
585         
586             
587 
588 <ul class="subnav menu">
589     
590         <li class="tier-2 element-1" role="treeitem"><a href="/community/diversity/" title="">Diversity</a></li>
591     
592         <li class="tier-2 element-2" role="treeitem"><a href="/community/irc/" title="">IRC</a></li>
593     
594         <li class="tier-2 element-3" role="treeitem"><a href="/community/lists/" title="">Mailing Lists</a></li>
595     
596         <li class="tier-2 element-4" role="treeitem"><a href="/community/workshops/" title="">Python Conferences</a></li>
597     
598         <li class="tier-2 element-5" role="treeitem"><a href="/community/sigs/" title="">Special Interest Groups</a></li>
599     
600         <li class="tier-2 element-6" role="treeitem"><a href="https://wiki.python.org/moin/" title="">Python Wiki</a></li>
601     
602         <li class="tier-2 element-7" role="treeitem"><a href="/community/logos/" title="">Python Logo</a></li>
603     
604         <li class="tier-2 element-8" role="treeitem"><a href="/community/merchandise/" title="">Merchandise</a></li>
605     
606         <li class="tier-2 element-9" role="treeitem"><a href="/community/awards" title="">Community Awards</a></li>
607     
608 </ul>
609 
610         
611     </li>
612     
613     <li class="tier-1 element-5">
614         <a href="/about/success/" title="success-stories">Success Stories</a>
615         
616             
617 
618 <ul class="subnav menu">
619     
620         <li class="tier-2 element-1" role="treeitem"><a href="/about/success/#arts" title="">Arts</a></li>
621     
622         <li class="tier-2 element-2" role="treeitem"><a href="/about/success/#business" title="">Business</a></li>
623     
624         <li class="tier-2 element-3" role="treeitem"><a href="/about/success/#education" title="">Education</a></li>
625     
626         <li class="tier-2 element-4" role="treeitem"><a href="/about/success/#engineering" title="">Engineering</a></li>
627     
628         <li class="tier-2 element-5" role="treeitem"><a href="/about/success/#government" title="">Government</a></li>
629     
630         <li class="tier-2 element-6" role="treeitem"><a href="/about/success/#scientific" title="">Scientific</a></li>
631     
632         <li class="tier-2 element-7" role="treeitem"><a href="/about/success/#software-development" title="">Software Development</a></li>
633     
634 </ul>
635 
636         
637     </li>
638     
639     <li class="tier-1 element-6">
640         <a href="/blogs/" title="News from around the Python world">News</a>
641         
642             
643 
644 <ul class="subnav menu">
645     
646         <li class="tier-2 element-1" role="treeitem"><a href="/blogs/" title="Python Insider Blog Posts">Python News</a></li>
647     
648         <li class="tier-2 element-2" role="treeitem"><a href="http://planetpython.org/" title="Planet Python">Community News</a></li>
649     
650         <li class="tier-2 element-3" role="treeitem"><a href="http://pyfound.blogspot.com/" title="PSF Blog">PSF News</a></li>
651     
652         <li class="tier-2 element-4" role="treeitem"><a href="http://pycon.blogspot.com/" title="PyCon Blog">PyCon News</a></li>
653     
654 </ul>
655 
656         
657     </li>
658     
659     <li class="tier-1 element-7">
660         <a href="/events/" >Events</a>
661         
662             
663 
664 <ul class="subnav menu">
665     
666         <li class="tier-2 element-1" role="treeitem"><a href="/events/python-events" title="">Python Events</a></li>
667     
668         <li class="tier-2 element-2" role="treeitem"><a href="/events/python-user-group/" title="">User Group Events</a></li>
669     
670         <li class="tier-2 element-3" role="treeitem"><a href="/events/python-events/past/" title="">Python Events Archive</a></li>
671     
672         <li class="tier-2 element-4" role="treeitem"><a href="/events/python-user-group/past/" title="">User Group Events Archive</a></li>
673     
674         <li class="tier-2 element-5" role="treeitem"><a href="https://wiki.python.org/moin/PythonEventsCalendar#Submitting_an_Event" title="">Submit an Event</a></li>
675     
676 </ul>
677 
678         
679     </li>
680     
681     <li class="tier-1 element-8">
682         <a href="/dev/" >Contributing</a>
683         
684             
685 
686 <ul class="subnav menu">
687     
688         <li class="tier-2 element-1" role="treeitem"><a href="http://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
689     
690         <li class="tier-2 element-2" role="treeitem"><a href="http://bugs.python.org/" title="">Issue Tracker</a></li>
691     
692         <li class="tier-2 element-3" role="treeitem"><a href="https://mail.python.org/mailman/listinfo/python-dev" title="">python-dev list</a></li>
693     
694         <li class="tier-2 element-4" role="treeitem"><a href="/dev/core-mentorship/" title="">Core Mentorship</a></li>
695     
696 </ul>
697 
698         
699     </li>
700     
701 </ul>
702 
703 
704                     <a id="back-to-top-2" class="jump-link" href="#python-network"><span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> Back to Top</a>
705                     
706 
707                 </div><!-- end .container -->
708             </div> <!-- end .main-footer-links -->
709 
710             <div class="site-base">
711                 <div class="container">
712                     
713                     <ul class="footer-links navigation menu do-not-print" role="tree">
714                         <li class="tier-1 element-1"><a href="/about/help/">Help &amp; <span class="say-no-more">General</span> Contact</a></li>
715                         <li class="tier-1 element-2"><a href="/community/diversity/">Diversity <span class="say-no-more">Initiatives</span></a></li>
716                         <li class="tier-1 element-3"><a href="https://github.com/python/pythondotorg/issues">Submit Website Bug</a></li>
717                         <li class="tier-1 element-4">
718                             <a href="https://status.python.org/">Status <span class="python-status-indicator-default" id="python-status-indicator"></span></a>
719                         </li>
720                     </ul>
721 
722                     <div class="copyright">
723                         <p><small>
724                             <span class="pre">Copyright &copy;2001-2017.</span>
725                             &nbsp;<span class="pre"><a href="/psf-landing/">Python Software Foundation</a></span>
726                             &nbsp;<span class="pre"><a href="/about/legal/">Legal Statements</a></span>
727                             &nbsp;<span class="pre"><a href="/privacy/">Privacy Policy</a></span>
728                         </small></p>
729                     </div>
730 
731                 </div><!-- end .container -->
732             </div><!-- end .site-base -->
733 
734         </footer>
735 
736     </div><!-- end #touchnav-wrapper -->
737 
738     
739     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
740     <script>window.jQuery || document.write(<script src="/static/js/libs/jquery-1.8.2.min.js"><\/script>)</script>
741 
742     <script src="/static/js/libs/masonry.pkgd.min.js"></script>
743 
744     <script type="text/javascript" src="/static/js/main-min.js" charset="utf-8"></script>
745     
746 
747     <!--[if lte IE 7]>
748     <script type="text/javascript" src="/static/js/plugins/IE8-min.js" charset="utf-8"></script>
749     
750     
751     <![endif]-->
752 
753     <!--[if lte IE 8]>
754     <script type="text/javascript" src="/static/js/plugins/getComputedStyle-min.js" charset="utf-8"></script>
755     
756     
757     <![endif]-->
758 
759     
760 
761     
762     
763 
764 </body>
765 </html>
返回结果

 

POST方法:

技术分享
1 #coding:UTF8
2 
3 import urllib
4 response = urllib.urlencode({orange:1,apple:2,eggs:3})
5 res = urllib.urlopen("http://python.org/query",response)
6 
7 print response
8 print res.read()
代码
技术分享
  1 orange=1&eggs=3&apple=2
  2 <!doctype html>
  3 <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
  4 <!--[if IE 7]>      <html class="no-js ie7 lt-ie8 lt-ie9">          <![endif]-->
  5 <!--[if IE 8]>      <html class="no-js ie8 lt-ie9">                 <![endif]-->
  6 <!--[if gt IE 8]><!--><html class="no-js" lang="en" dir="ltr">  <!--<![endif]-->
  7 
  8 <head>
  9     <meta charset="utf-8">
 10     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 11 
 12     <link rel="prefetch" href="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
 13 
 14     <meta name="application-name" content="Python.org">
 15     <meta name="msapplication-tooltip" content="The official home of the Python Programming Language">
 16     <meta name="apple-mobile-web-app-title" content="Python.org">
 17     <meta name="apple-mobile-web-app-capable" content="yes">
 18     <meta name="apple-mobile-web-app-status-bar-style" content="black">
 19 
 20     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 21     <meta name="HandheldFriendly" content="True">
 22     <meta name="format-detection" content="telephone=no">
 23     <meta http-equiv="cleartype" content="on">
 24     <meta http-equiv="imagetoolbar" content="false">
 25 
 26     <script src="/static/js/libs/modernizr.js"></script>
 27 
 28     <link href="/static/stylesheets/style.css" rel="stylesheet" type="text/css" title="default" />
 29     <link href="/static/stylesheets/mq.css" rel="stylesheet" type="text/css" media="not print, braille, embossed, speech, tty" />
 30     
 31 
 32     <!--[if (lte IE 8)&(!IEMobile)]>
 33     <link href="/static/stylesheets/no-mq.css" rel="stylesheet" type="text/css" media="screen" />
 34     
 35     
 36     <![endif]-->
 37 
 38     
 39     <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
 40     <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/apple-touch-icon-144x144-precomposed.png">
 41     <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/apple-touch-icon-114x114-precomposed.png">
 42     <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/apple-touch-icon-72x72-precomposed.png">
 43     <link rel="apple-touch-icon-precomposed" href="/static/apple-touch-icon-precomposed.png">
 44     <link rel="apple-touch-icon" href="/static/apple-touch-icon-precomposed.png">
 45 
 46     
 47     <meta name="msapplication-TileImage" content="/static/metro-icon-144x144-precomposed.png"><!-- white shape -->
 48     <meta name="msapplication-TileColor" content="#3673a5"><!-- python blue -->
 49     <meta name="msapplication-navbutton-color" content="#3673a5">
 50 
 51     <title>Welcome to Python.org</title>
 52 
 53     <meta name="description" content="The official home of the Python Programming Language">
 54     <meta name="keywords" content="Python programming language object oriented web free open source software license documentation download community">
 55 
 56     
 57     <meta property="og:type" content="website">
 58     <meta property="og:site_name" content="Python.org">
 59     <meta property="og:title" content="Welcome to Python.org">
 60     <meta property="og:description" content="The official home of the Python Programming Language">
 61     
 62     <meta property="og:image" content="https://www.python.org/static/opengraph-icon-200x200.png">
 63     <meta property="og:image:secure_url" content="https://www.python.org/static/opengraph-icon-200x200.png">
 64     
 65     <meta property="og:url" content="https://www.python.org/query">
 66 
 67     <link rel="author" href="/static/humans.txt">
 68 
 69     
 70 
 71     
 72     <script type="application/ld+json">
 73      {
 74        "@context": "http://schema.org",
 75        "@type": "WebSite",
 76        "url": "https://www.python.org/",
 77        "potentialAction": {
 78          "@type": "SearchAction",
 79          "target": "https://www.python.org/search/?q={search_term_string}",
 80          "query-input": "required name=search_term_string"
 81        }
 82      }
 83     </script>
 84 
 85     
 86     <script type="text/javascript">
 87     var _gaq = _gaq || [];
 88     _gaq.push([_setAccount, UA-39055973-1]);
 89     _gaq.push([_trackPageview]);
 90 
 91     (function() {
 92         var ga = document.createElement(script); ga.type = text/javascript; ga.async = true;
 93         ga.src = (https: == document.location.protocol ? https://ssl : http://www) + .google-analytics.com/ga.js;
 94         var s = document.getElementsByTagName(script)[0]; s.parentNode.insertBefore(ga, s);
 95     })();
 96     </script>
 97     
 98 </head>
 99 
100 <body class="python default-page fourohfour">
101 
102     <div id="touchnav-wrapper">
103 
104         <div id="nojs" class="do-not-print">
105             <p><strong>Notice:</strong> While Javascript is not essential for this website, your interaction with the content will be limited. Please turn Javascript on for the full experience. </p>
106         </div>
107 
108         <!--[if lt IE 8]>
109         <div id="oldie-warning" class="do-not-print">
110             <p><strong>Notice:</strong> Your browser is <em>ancient</em> and <a href="http://www.ie6countdown.com/">Microsoft agrees</a>. <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience a better web.</p>
111         </div>
112         <![endif]-->
113 
114         <!-- Sister Site Links -->
115         <div id="top" class="top-bar do-not-print">
116 
117             <nav class="meta-navigation container" role="navigation">
118 
119                 
120                 <div class="skip-link screen-reader-text">
121                     <a href="#content" title="Skip to content">Skip to content</a>
122                 </div>
123 
124                 
125                 <a id="close-python-network" class="jump-link" href="#python-network" aria-hidden="true">
126                     <span aria-hidden="true" class="icon-arrow-down"><span>&#9660;</span></span> Close
127                 </a>
128 
129                 
130 
131 <ul class="menu" role="tree">
132     
133     <li class="python-meta ">
134         <a href="/" title="The Python Programming Language" >Python</a>
135     </li>
136     
137     <li class="psf-meta ">
138         <a href="/psf-landing/" title="The Python Software Foundation" >PSF</a>
139     </li>
140     
141     <li class="docs-meta ">
142         <a href="https://docs.python.org" title="Python Documentation" >Docs</a>
143     </li>
144     
145     <li class="pypi-meta ">
146         <a href="https://pypi.python.org/" title="Python Package Index" >PyPI</a>
147     </li>
148     
149     <li class="jobs-meta ">
150         <a href="/jobs/" title="Python Job Board" >Jobs</a>
151     </li>
152     
153     <li class="shop-meta ">
154         <a href="/community/" title="Python Community" >Community</a>
155     </li>
156     
157 </ul>
158 
159 
160                 <a id="python-network" class="jump-link" href="#top" aria-hidden="true">
161                     <span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> The Python Network
162                 </a>
163 
164             </nav>
165 
166         </div>
167 
168         <!-- Header elements -->
169         <header class="main-header" role="banner">
170             <div class="container">
171 
172                 <h1 class="site-headline">
173                     <a href="/"><img class="python-logo" src="/static/img/python-logo.png" alt="python&trade;"></a>
174                 </h1>
175 
176                 <div class="options-bar do-not-print">
177 
178                     
179                     <a id="site-map-link" class="jump-to-menu" href="#site-map"><span class="menu-icon">&equiv;</span> Menu</a><form class="search-the-site" action="/search/" method="get">
180                         <fieldset title="Search Python.org">
181 
182                             <span aria-hidden="true" class="icon-search"></span>
183 
184                             <label class="screen-reader-text" for="id-search-field">Search This Site</label>
185                             <input id="id-search-field" name="q" type="search" role="textbox" class="search-field" placeholder="Search" value="" tabindex="1">
186 
187                             <button type="submit" name="submit" id="submit" class="search-button" title="Submit this Search" tabindex="3">
188                                 GO
189                             </button>
190 
191                             
192                             <!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" tabindex="4"><![endif]-->
193 
194                         </fieldset>
195                     </form><span class="breaker"></span><div class="adjust-font-size" aria-hidden="true">
196                         <ul class="navigation menu" aria-label="Adjust Text Size on Page">
197                             <li class="tier-1 last" aria-haspopup="true">
198                                 <a href="#" class="action-trigger"><strong><small>A</small> A</strong></a>
199                                 <ul class="subnav menu">
200                                     <li class="tier-2 element-1" role="treeitem"><a class="text-shrink" title="Make Text Smaller" href="javascript:;">Smaller</a></li>
201                                     <li class="tier-2 element-2" role="treeitem"><a class="text-grow" title="Make Text Larger" href="javascript:;">Larger</a></li>
202                                     <li class="tier-2 element-3" role="treeitem"><a class="text-reset" title="Reset any font size changes I have made" href="javascript:;">Reset</a></li>
203                                 </ul>
204                             </li>
205                         </ul>
206                     </div><div class="winkwink-nudgenudge">
207                         <ul class="navigation menu" aria-label="Social Media Navigation">
208                             <li class="tier-1 last" aria-haspopup="true">
209                                 <a href="#" class="action-trigger">Socialize</a>
210                                 <ul class="subnav menu">
211                                     <li class="tier-2 element-1" role="treeitem"><a href="http://plus.google.com/+Python"><span aria-hidden="true" class="icon-google-plus"></span>Google+</a></li>
212                                     <li class="tier-2 element-2" role="treeitem"><a href="http://www.facebook.com/pythonlang?fref=ts"><span aria-hidden="true" class="icon-facebook"></span>Facebook</a></li>
213                                     <li class="tier-2 element-3" role="treeitem"><a href="http://twitter.com/ThePSF"><span aria-hidden="true" class="icon-twitter"></span>Twitter</a></li>
214                                     <li class="tier-2 element-4" role="treeitem"><a href="/community/irc/"><span aria-hidden="true" class="icon-freenode"></span>Chat on IRC</a></li>
215                                 </ul>
216                             </li>
217                         </ul>
218                     </div><div class="account-signin">
219                         <ul class="navigation menu" aria-label="Social Media Navigation">
220                             <li class="tier-1 last" aria-haspopup="true">
221                                 
222                                 <a href="/accounts/login/" title="Sign Up or Sign In to Python.org">Sign In</a>
223                                 <ul class="subnav menu">
224                                     <li class="tier-2 element-1" role="treeitem"><a href="/accounts/signup/">Sign Up / Register</a></li>
225                                     <li class="tier-2 element-2" role="treeitem"><a href="/accounts/login/">Sign In</a></li>
226                                 </ul>
227                                 
228                             </li>
229                         </ul>
230                     </div>
231 
232                 </div><!-- end options-bar -->
233 
234                 <nav id="mainnav" class="python-navigation main-navigation do-not-print" role="navigation">
235                     
236                         
237 <ul class="navigation menu" role="menubar" aria-label="Main Navigation">
238   
239     
240     
241     <li id="about" class="tier-1 element-1  " aria-haspopup="true">
242         <a href="/about/" title="" class="">About</a>
243         
244             
245 
246 <ul class="subnav menu" role="menu" aria-hidden="true">
247     
248         <li class="tier-2 element-1" role="treeitem"><a href="/about/apps/" title="">Applications</a></li>
249     
250         <li class="tier-2 element-2" role="treeitem"><a href="/about/quotes/" title="">Quotes</a></li>
251     
252         <li class="tier-2 element-3" role="treeitem"><a href="/about/gettingstarted/" title="">Getting Started</a></li>
253     
254         <li class="tier-2 element-4" role="treeitem"><a href="/about/help/" title="">Help</a></li>
255     
256         <li class="tier-2 element-5" role="treeitem"><a href="http://brochure.getpython.info/" title="">Python Brochure</a></li>
257     
258 </ul>
259 
260         
261     </li>
262     
263     
264     
265     <li id="downloads" class="tier-1 element-2  " aria-haspopup="true">
266         <a href="/downloads/" title="" class="">Downloads</a>
267         
268             
269 
270 <ul class="subnav menu" role="menu" aria-hidden="true">
271     
272         <li class="tier-2 element-1" role="treeitem"><a href="/downloads/" title="">All releases</a></li>
273     
274         <li class="tier-2 element-2" role="treeitem"><a href="/downloads/source/" title="">Source code</a></li>
275     
276         <li class="tier-2 element-3" role="treeitem"><a href="/downloads/windows/" title="">Windows</a></li>
277     
278         <li class="tier-2 element-4" role="treeitem"><a href="/downloads/mac-osx/" title="">Mac OS X</a></li>
279     
280         <li class="tier-2 element-5" role="treeitem"><a href="/download/other/" title="">Other Platforms</a></li>
281     
282         <li class="tier-2 element-6" role="treeitem"><a href="https://docs.python.org/3/license.html" title="">License</a></li>
283     
284         <li class="tier-2 element-7" role="treeitem"><a href="/download/alternatives" title="">Alternative Implementations</a></li>
285     
286 </ul>
287 
288         
289     </li>
290     
291     
292     
293     <li id="documentation" class="tier-1 element-3  " aria-haspopup="true">
294         <a href="/doc/" title="" class="">Documentation</a>
295         
296             
297 
298 <ul class="subnav menu" role="menu" aria-hidden="true">
299     
300         <li class="tier-2 element-1" role="treeitem"><a href="/doc/" title="">Docs</a></li>
301     
302         <li class="tier-2 element-2" role="treeitem"><a href="/doc/av" title="">Audio/Visual Talks</a></li>
303     
304         <li class="tier-2 element-3" role="treeitem"><a href="https://wiki.python.org/moin/BeginnersGuide" title="">Beginner&#39;s Guide</a></li>
305     
306         <li class="tier-2 element-4" role="treeitem"><a href="https://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
307     
308         <li class="tier-2 element-5" role="treeitem"><a href="https://docs.python.org/faq/" title="">FAQ</a></li>
309     
310         <li class="tier-2 element-6" role="treeitem"><a href="http://wiki.python.org/moin/Languages" title="">Non-English Docs</a></li>
311     
312         <li class="tier-2 element-7" role="treeitem"><a href="http://python.org/dev/peps/" title="">PEP Index</a></li>
313     
314         <li class="tier-2 element-8" role="treeitem"><a href="https://wiki.python.org/moin/PythonBooks" title="">Python Books</a></li>
315     
316 </ul>
317 
318         
319     </li>
320     
321     
322     
323     <li id="community" class="tier-1 element-4  " aria-haspopup="true">
324         <a href="/community/" title="" class="">Community</a>
325         
326             
327 
328 <ul class="subnav menu" role="menu" aria-hidden="true">
329     
330         <li class="tier-2 element-1" role="treeitem"><a href="/community/diversity/" title="">Diversity</a></li>
331     
332         <li class="tier-2 element-2" role="treeitem"><a href="/community/irc/" title="">IRC</a></li>
333     
334         <li class="tier-2 element-3" role="treeitem"><a href="/community/lists/" title="">Mailing Lists</a></li>
335     
336         <li class="tier-2 element-4" role="treeitem"><a href="/community/workshops/" title="">Python Conferences</a></li>
337     
338         <li class="tier-2 element-5" role="treeitem"><a href="/community/sigs/" title="">Special Interest Groups</a></li>
339     
340         <li class="tier-2 element-6" role="treeitem"><a href="https://wiki.python.org/moin/" title="">Python Wiki</a></li>
341     
342         <li class="tier-2 element-7" role="treeitem"><a href="/community/logos/" title="">Python Logo</a></li>
343     
344         <li class="tier-2 element-8" role="treeitem"><a href="/community/merchandise/" title="">Merchandise</a></li>
345     
346         <li class="tier-2 element-9" role="treeitem"><a href="/community/awards" title="">Community Awards</a></li>
347     
348 </ul>
349 
350         
351     </li>
352     
353     
354     
355     <li id="success-stories" class="tier-1 element-5  " aria-haspopup="true">
356         <a href="/about/success/" title="success-stories" class="">Success Stories</a>
357         
358             
359 
360 <ul class="subnav menu" role="menu" aria-hidden="true">
361     
362         <li class="tier-2 element-1" role="treeitem"><a href="/about/success/#arts" title="">Arts</a></li>
363     
364         <li class="tier-2 element-2" role="treeitem"><a href="/about/success/#business" title="">Business</a></li>
365     
366         <li class="tier-2 element-3" role="treeitem"><a href="/about/success/#education" title="">Education</a></li>
367     
368         <li class="tier-2 element-4" role="treeitem"><a href="/about/success/#engineering" title="">Engineering</a></li>
369     
370         <li class="tier-2 element-5" role="treeitem"><a href="/about/success/#government" title="">Government</a></li>
371     
372         <li class="tier-2 element-6" role="treeitem"><a href="/about/success/#scientific" title="">Scientific</a></li>
373     
374         <li class="tier-2 element-7" role="treeitem"><a href="/about/success/#software-development" title="">Software Development</a></li>
375     
376 </ul>
377 
378         
379     </li>
380     
381     
382     
383     <li id="news" class="tier-1 element-6  " aria-haspopup="true">
384         <a href="/blogs/" title="News from around the Python world" class="">News</a>
385         
386             
387 
388 <ul class="subnav menu" role="menu" aria-hidden="true">
389     
390         <li class="tier-2 element-1" role="treeitem"><a href="/blogs/" title="Python Insider Blog Posts">Python News</a></li>
391     
392         <li class="tier-2 element-2" role="treeitem"><a href="http://planetpython.org/" title="Planet Python">Community News</a></li>
393     
394         <li class="tier-2 element-3" role="treeitem"><a href="http://pyfound.blogspot.com/" title="PSF Blog">PSF News</a></li>
395     
396         <li class="tier-2 element-4" role="treeitem"><a href="http://pycon.blogspot.com/" title="PyCon Blog">PyCon News</a></li>
397     
398 </ul>
399 
400         
401     </li>
402     
403     
404     
405     <li id="events" class="tier-1 element-7  " aria-haspopup="true">
406         <a href="/events/" title="" class="">Events</a>
407         
408             
409 
410 <ul class="subnav menu" role="menu" aria-hidden="true">
411     
412         <li class="tier-2 element-1" role="treeitem"><a href="/events/python-events" title="">Python Events</a></li>
413     
414         <li class="tier-2 element-2" role="treeitem"><a href="/events/python-user-group/" title="">User Group Events</a></li>
415     
416         <li class="tier-2 element-3" role="treeitem"><a href="/events/python-events/past/" title="">Python Events Archive</a></li>
417     
418         <li class="tier-2 element-4" role="treeitem"><a href="/events/python-user-group/past/" title="">User Group Events Archive</a></li>
419     
420         <li class="tier-2 element-5" role="treeitem"><a href="https://wiki.python.org/moin/PythonEventsCalendar#Submitting_an_Event" title="">Submit an Event</a></li>
421     
422 </ul>
423 
424         
425     </li>
426     
427     
428     
429     
430   
431 </ul>
432 
433                     
434                 </nav>
435 
436                 <div class="header-banner "> <!-- for optional "do-not-print" class -->
437                     
438                     
439                 </div>
440 
441                 
442                 
443 
444              </div><!-- end .container -->
445         </header>
446 
447         <div id="content" class="content-wrapper">
448             <!-- Main Content Column -->
449             <div class="container">
450 
451                 <section class="main-content " role="main">
452 
453                     
454                     
455 
456                     
457 
458                     
459     
460     <article class="text">
461             
462         <h1 class="giga">Error 404: File not Found</h1>
463         
464         <p>We couldn&rsquo;t find what you were looking for. This error has been reported and we will look into it shortly. For now,</p>
465 
466         <ul>
467             <li>Try using the search box.</li>
468             <li>
469                 Python.org went through a redesign and you may have followed a broken link.
470                 Sorry for that, see if <a href="http://legacy.python.org/query">the same page on the legacy website</a> works.
471             </li>
472             <li>
473                 Lost in an exotic function call? Read <a href="/doc/">the docs</a>.
474                 Looking for a package? Check the <a href="https://pypi.python.org/">Package Index</a>.
475                 Need a specific version of Python? The <a href="/downloads/">downloads section</a> has it.
476             </li>
477         </ul>
478         
479     </article>
480     
481 
482 
483                 </section>
484 
485                 
486                 
487 
488                 
489                 
490 
491 
492             </div><!-- end .container -->
493         </div><!-- end #content .content-wrapper -->
494 
495         <!-- Footer and social media list -->
496         <footer id="site-map" class="main-footer" role="contentinfo">
497             <div class="main-footer-links">
498                 <div class="container">
499 
500                     
501                     <a id="back-to-top-1" class="jump-link" href="#python-network"><span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> Back to Top</a>
502 
503                     
504 
505 <ul class="sitemap navigation menu do-not-print" role="tree" id="container">
506     
507     <li class="tier-1 element-1">
508         <a href="/about/" >About</a>
509         
510             
511 
512 <ul class="subnav menu">
513     
514         <li class="tier-2 element-1" role="treeitem"><a href="/about/apps/" title="">Applications</a></li>
515     
516         <li class="tier-2 element-2" role="treeitem"><a href="/about/quotes/" title="">Quotes</a></li>
517     
518         <li class="tier-2 element-3" role="treeitem"><a href="/about/gettingstarted/" title="">Getting Started</a></li>
519     
520         <li class="tier-2 element-4" role="treeitem"><a href="/about/help/" title="">Help</a></li>
521     
522         <li class="tier-2 element-5" role="treeitem"><a href="http://brochure.getpython.info/" title="">Python Brochure</a></li>
523     
524 </ul>
525 
526         
527     </li>
528     
529     <li class="tier-1 element-2">
530         <a href="/downloads/" >Downloads</a>
531         
532             
533 
534 <ul class="subnav menu">
535     
536         <li class="tier-2 element-1" role="treeitem"><a href="/downloads/" title="">All releases</a></li>
537     
538         <li class="tier-2 element-2" role="treeitem"><a href="/downloads/source/" title="">Source code</a></li>
539     
540         <li class="tier-2 element-3" role="treeitem"><a href="/downloads/windows/" title="">Windows</a></li>
541     
542         <li class="tier-2 element-4" role="treeitem"><a href="/downloads/mac-osx/" title="">Mac OS X</a></li>
543     
544         <li class="tier-2 element-5" role="treeitem"><a href="/download/other/" title="">Other Platforms</a></li>
545     
546         <li class="tier-2 element-6" role="treeitem"><a href="https://docs.python.org/3/license.html" title="">License</a></li>
547     
548         <li class="tier-2 element-7" role="treeitem"><a href="/download/alternatives" title="">Alternative Implementations</a></li>
549     
550 </ul>
551 
552         
553     </li>
554     
555     <li class="tier-1 element-3">
556         <a href="/doc/" >Documentation</a>
557         
558             
559 
560 <ul class="subnav menu">
561     
562         <li class="tier-2 element-1" role="treeitem"><a href="/doc/" title="">Docs</a></li>
563     
564         <li class="tier-2 element-2" role="treeitem"><a href="/doc/av" title="">Audio/Visual Talks</a></li>
565     
566         <li class="tier-2 element-3" role="treeitem"><a href="https://wiki.python.org/moin/BeginnersGuide" title="">Beginner&#39;s Guide</a></li>
567     
568         <li class="tier-2 element-4" role="treeitem"><a href="https://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
569     
570         <li class="tier-2 element-5" role="treeitem"><a href="https://docs.python.org/faq/" title="">FAQ</a></li>
571     
572         <li class="tier-2 element-6" role="treeitem"><a href="http://wiki.python.org/moin/Languages" title="">Non-English Docs</a></li>
573     
574         <li class="tier-2 element-7" role="treeitem"><a href="http://python.org/dev/peps/" title="">PEP Index</a></li>
575     
576         <li class="tier-2 element-8" role="treeitem"><a href="https://wiki.python.org/moin/PythonBooks" title="">Python Books</a></li>
577     
578 </ul>
579 
580         
581     </li>
582     
583     <li class="tier-1 element-4">
584         <a href="/community/" >Community</a>
585         
586             
587 
588 <ul class="subnav menu">
589     
590         <li class="tier-2 element-1" role="treeitem"><a href="/community/diversity/" title="">Diversity</a></li>
591     
592         <li class="tier-2 element-2" role="treeitem"><a href="/community/irc/" title="">IRC</a></li>
593     
594         <li class="tier-2 element-3" role="treeitem"><a href="/community/lists/" title="">Mailing Lists</a></li>
595     
596         <li class="tier-2 element-4" role="treeitem"><a href="/community/workshops/" title="">Python Conferences</a></li>
597     
598         <li class="tier-2 element-5" role="treeitem"><a href="/community/sigs/" title="">Special Interest Groups</a></li>
599     
600         <li class="tier-2 element-6" role="treeitem"><a href="https://wiki.python.org/moin/" title="">Python Wiki</a></li>
601     
602         <li class="tier-2 element-7" role="treeitem"><a href="/community/logos/" title="">Python Logo</a></li>
603     
604         <li class="tier-2 element-8" role="treeitem"><a href="/community/merchandise/" title="">Merchandise</a></li>
605     
606         <li class="tier-2 element-9" role="treeitem"><a href="/community/awards" title="">Community Awards</a></li>
607     
608 </ul>
609 
610         
611     </li>
612     
613     <li class="tier-1 element-5">
614         <a href="/about/success/" title="success-stories">Success Stories</a>
615         
616             
617 
618 <ul class="subnav menu">
619     
620         <li class="tier-2 element-1" role="treeitem"><a href="/about/success/#arts" title="">Arts</a></li>
621     
622         <li class="tier-2 element-2" role="treeitem"><a href="/about/success/#business" title="">Business</a></li>
623     
624         <li class="tier-2 element-3" role="treeitem"><a href="/about/success/#education" title="">Education</a></li>
625     
626         <li class="tier-2 element-4" role="treeitem"><a href="/about/success/#engineering" title="">Engineering</a></li>
627     
628         <li class="tier-2 element-5" role="treeitem"><a href="/about/success/#government" title="">Government</a></li>
629     
630         <li class="tier-2 element-6" role="treeitem"><a href="/about/success/#scientific" title="">Scientific</a></li>
631     
632         <li class="tier-2 element-7" role="treeitem"><a href="/about/success/#software-development" title="">Software Development</a></li>
633     
634 </ul>
635 
636         
637     </li>
638     
639     <li class="tier-1 element-6">
640         <a href="/blogs/" title="News from around the Python world">News</a>
641         
642             
643 
644 <ul class="subnav menu">
645     
646         <li class="tier-2 element-1" role="treeitem"><a href="/blogs/" title="Python Insider Blog Posts">Python News</a></li>
647     
648         <li class="tier-2 element-2" role="treeitem"><a href="http://planetpython.org/" title="Planet Python">Community News</a></li>
649     
650         <li class="tier-2 element-3" role="treeitem"><a href="http://pyfound.blogspot.com/" title="PSF Blog">PSF News</a></li>
651     
652         <li class="tier-2 element-4" role="treeitem"><a href="http://pycon.blogspot.com/" title="PyCon Blog">PyCon News</a></li>
653     
654 </ul>
655 
656         
657     </li>
658     
659     <li class="tier-1 element-7">
660         <a href="/events/" >Events</a>
661         
662             
663 
664 <ul class="subnav menu">
665     
666         <li class="tier-2 element-1" role="treeitem"><a href="/events/python-events" title="">Python Events</a></li>
667     
668         <li class="tier-2 element-2" role="treeitem"><a href="/events/python-user-group/" title="">User Group Events</a></li>
669     
670         <li class="tier-2 element-3" role="treeitem"><a href="/events/python-events/past/" title="">Python Events Archive</a></li>
671     
672         <li class="tier-2 element-4" role="treeitem"><a href="/events/python-user-group/past/" title="">User Group Events Archive</a></li>
673     
674         <li class="tier-2 element-5" role="treeitem"><a href="https://wiki.python.org/moin/PythonEventsCalendar#Submitting_an_Event" title="">Submit an Event</a></li>
675     
676 </ul>
677 
678         
679     </li>
680     
681     <li class="tier-1 element-8">
682         <a href="/dev/" >Contributing</a>
683         
684             
685 
686 <ul class="subnav menu">
687     
688         <li class="tier-2 element-1" role="treeitem"><a href="http://docs.python.org/devguide/" title="">Developer&#39;s Guide</a></li>
689     
690         <li class="tier-2 element-2" role="treeitem"><a href="http://bugs.python.org/" title="">Issue Tracker</a></li>
691     
692         <li class="tier-2 element-3" role="treeitem"><a href="https://mail.python.org/mailman/listinfo/python-dev" title="">python-dev list</a></li>
693     
694         <li class="tier-2 element-4" role="treeitem"><a href="/dev/core-mentorship/" title="">Core Mentorship</a></li>
695     
696 </ul>
697 
698         
699     </li>
700     
701 </ul>
702 
703 
704                     <a id="back-to-top-2" class="jump-link" href="#python-network"><span aria-hidden="true" class="icon-arrow-up"><span>&#9650;</span></span> Back to Top</a>
705                     
706 
707                 </div><!-- end .container -->
708             </div> <!-- end .main-footer-links -->
709 
710             <div class="site-base">
711                 <div class="container">
712                     
713                     <ul class="footer-links navigation menu do-not-print" role="tree">
714                         <li class="tier-1 element-1"><a href="/about/help/">Help &amp; <span class="say-no-more">General</span> Contact</a></li>
715                         <li class="tier-1 element-2"><a href="/community/diversity/">Diversity <span class="say-no-more">Initiatives</span></a></li>
716                         <li class="tier-1 element-3"><a href="https://github.com/python/pythondotorg/issues">Submit Website Bug</a></li>
717                         <li class="tier-1 element-4">
718                             <a href="https://status.python.org/">Status <span class="python-status-indicator-default" id="python-status-indicator"></span></a>
719                         </li>
720                     </ul>
721 
722                     <div class="copyright">
723                         <p><small>
724                             <span class="pre">Copyright &copy;2001-2017.</span>
725                             &nbsp;<span class="pre"><a href="/psf-landing/">Python Software Foundation</a></span>
726                             &nbsp;<span class="pre"><a href="/about/legal/">Legal Statements</a></span>
727                             &nbsp;<span class="pre"><a href="/privacy/">Privacy Policy</a></span>
728                         </small></p>
729                     </div>
730 
731                 </div><!-- end .container -->
732             </div><!-- end .site-base -->
733 
734         </footer>
735 
736     </div><!-- end #touchnav-wrapper -->
737 
738     
739     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
740     <script>window.jQuery || document.write(<script src="/static/js/libs/jquery-1.8.2.min.js"><\/script>)</script>
741 
742     <script src="/static/js/libs/masonry.pkgd.min.js"></script>
743 
744     <script type="text/javascript" src="/static/js/main-min.js" charset="utf-8"></script>
745     
746 
747     <!--[if lte IE 7]>
748     <script type="text/javascript" src="/static/js/plugins/IE8-min.js" charset="utf-8"></script>
749     
750     
751     <![endif]-->
752 
753     <!--[if lte IE 8]>
754     <script type="text/javascript" src="/static/js/plugins/getComputedStyle-min.js" charset="utf-8"></script>
755     
756     
757     <![endif]-->
758 
759     
760 
761     
762     
763 
764 </body>
765 </html>
返回结果

 

python urllib模块

标签:prot   soft   design   viewport   cleanup   favicon   als   amp   follow   

原文地址:http://www.cnblogs.com/qianyuliang/p/6408896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!