W
Threading Programming using Python
Https://www.ibm.com/developerworks/cn/aix/library/au-threadingpython/index.html
C:\>python E:\MATHpyCLI\url_fetch_serial.py<! DOCTYPE html>'Utf-8'> <title>Redis</title> <link href='/styles.css'Rel='stylesheet'> <link href='/images/favicon.png'Rel='shortcut icon'> <link href='/opensearch.xml'Rel='Search'title='Look up a Redis command'Type='APPLICATION/OPENSEARCHDESCRI<meta content='width=device-width, minimum-scale=1.0, maximum-scale=1.0'Name='Viewport'> <script>var _gaq= _gaq | | []; _gaq.push (['_setaccount','ua-20243082-1']); _gaq.push (['_trackpageview']); (function () {var ga= Document.createelement ('Script'); Ga.type ='Text/javascript'; Ga.async =true; GA.SRC= ('https:'= = Document.location.protocol?'Https://ssl':'http://www') +'. GOOGLE-ANALYTICS.Cvar s = document.getelementsbytagname ('Script') [0]; S.parentnode.insertbefore (GA, s); })(); </script> class="'> <divclass='Mobile-menu Slideout-menu'> class='Menu-header'></Heade<! DOCTYPE html>"en"> "Content-type"Content="text/html; Charset=utf-8"/> <link rel="icon"Type="Image/x-icon"href="/favicon.ico"/> <link type="Text/css"href="/css/pages.css"Media=" All"Rel="stylesheet"> <!--Begin Jekyll SEO tag v2.2.0--><title>github Pages | Websites forYou andYour projects, hosted directly fromyour GitHub repository. Just Edit<meta property="Og:title"Content="GitHub Pages"/><meta property="Og:locale"Content="en_US"/><meta name="Description"Content="Websites for your and your projects, hosted directly from your GitHub repositor<meta property="og:description"Content="Websites for your and your projects, hosted directly from your GitHub re<link rel="Canonical"href="https://pages.github.com/"/><meta property="Og:url"Content="https://pages.github.com/"/><meta property="ogElapsed time:20.3339998722C +>
url_fetch_serial.py
ImportUrllib2Import Time#hosts = ["Https://apple.com", "https://ibm.com", "https://amazon.com"]hosts = ["Https://redis.io","Http://github.io"]start=time.time () forHostinchHosts:url=Urllib2.urlopen (host)PrintUrl.read (1024)Print "Elapsed Time:%s"% (Time.time ()-start)
Using Thread queues