zoukankan      html  css  js  c++  java
  • 使用线程队列

    w

    使用 Python 进行线程编程
    https://www.ibm.com/developerworks/cn/aix/library/au-threadingpython/index.html

    C:>python E:MATHpyCLIurl_fetch_serial.py
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset='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.c
             var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
           })();
        </script>
      </head>
      <body class=''>
        <div class='mobile-menu slideout-menu'>
          <header class='menu-header'></heade
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta http-equiv="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 for you and your projects, hosted directly from your GitHub repository. Just edit
    <meta property="og:title" content="GitHub Pages" />
    <meta property="og:locale" content="en_US" />
    <meta name="description" content="Websites for you and your projects, hosted directly from your GitHub repositor
    <meta property="og:description" content="Websites for you 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="og
    Elapsed Time: 20.3339998722
    
    C:>

    url_fetch_serial.py

    import urllib2
    import time
    #hosts = ["https://apple.com","https://ibm.com","https://amazon.com"]
    hosts = ["https://redis.io","http://github.io"]
    
    start = time.time()
    
    for host in hosts:
        url = urllib2.urlopen(host)
        print url.read(1024)
    print "Elapsed Time: %s" % (time.time()-start)
  • 相关阅读:
    awk语法
    Linux 统计某个字符串出现的次数
    Linux 输出文件列数,拼接文件
    Linux之date
    C变量类型和作用域
    Java垃圾回收机制
    python 字符编码问题
    Linux文件和windows文件在 换行符的区别
    不要在 foreach 循环里进行元素的 remove/add 操作。remove 元素请使用 Iterator 方式,如果并发操作,需要对 Iterator 对象加锁
    Iterator和ListIterator
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6785499.html
Copyright © 2011-2022 走看看