Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / Python while 循环语句

本实例使用python的while语句来进行刷自己博客注:本功能只为展示python的强悍功能,不为攻击任何人,让我们做良民网友//引入所需要的python包import webbrowser as web  as是把包明子改或者叫连接为as
import time
import os
import random//使用random包里面的randint方法来随机生成一个2到4的数字count = random.randint(2,4)//这里是做了一个while嵌套
a = 0
while a <count:
    a = a+1
    i = 0
    while i <= 19:        //使用webbrowser包里面的ope_new_tab方法来打开相应的url地址        web.open_new_tab("http://xinsir.blog.51cto.com/5038915/1537866") 
        i = i + 1        //当打开第二个窗口前,停留1秒钟时间
        time.sleep(1)
    else:        //如果已经刷满20次,那么等待1秒然后关闭浏览器
        time.sleep(1)
        os.system("taskkill /F /IM chrome.exe")《Python核心编程 第二版》.(Wesley J. Chun ).[高清PDF中文版] http://www.linuxidc.com/Linux/2013-06/85425.htm《Python开发技术详解》.( 周伟,宗杰).[高清PDF扫描版+随书视频+代码] http://www.linuxidc.com/Linux/2013-11/92693.htmPython脚本获取Linux系统信息 http://www.linuxidc.com/Linux/2013-08/88531.htm在Ubuntu下用Python搭建桌面算法交易研究环境 http://www.linuxidc.com/Linux/2013-11/92534.htmPython 的详细介绍:请点这里
Python 的下载地址:请点这里本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-08/105421.htm