03 2015 档案
摘要:代码:#coding=utf-8from selenium import webdriverdriver=webdriver.Chrome() #调用chrome浏览器driver.get('https://www.baidu.com')print driver.titledriver.quit(...
阅读全文
摘要:代码如下:#coding=utf-8from selenium import webdriverdriver=webdriver.Ie()driver.get('https://www.baidu.com')print driver.titledriver.quit()报错:Traceback (m...
阅读全文
摘要:格式化输出:str.format()的用法for x in range(1,11): print('{0:2d} {1:3d} {2:4d}'.format(x, x*x,x*x*x))----------输出如下---------- 1 1 1 2 4 8 3 9 ...
阅读全文
摘要:原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples在字典中循环时,关键字和对应的值可以使用iteritems()方法同时解读出来。knights = {'gallahad': 'the pure...
阅读全文
摘要:原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples理解字典的最佳方式是把它看做无序的键:值对(key:value 对)集合,键必须是互不相同的(在同一个字典之内)。一对大括号创建一个空的字典:{...
阅读全文
摘要:原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples集合是一个无序不重复元素的集。基本功能包括关系测试和消除重复元素。集合对象还支持 union(联合),intersection(交),diffe...
阅读全文
摘要:tuple0=() #空tuple1="wo", #元组中包括单个元素用,tuple2="monkey","cat","chickey" #可以不用()tuple3=("monkey","cat","chickey")
阅读全文
摘要:列表常用方法汇总:#定义列表lili=[12.23,456,88,9]a=[1,2,3]#添加元素到列表结尾li.append(360)#追加列表元素extend(L)li.extend(a)#在指定位置插入一个元素insert(i,x)li.insert(0, 888)#删除列表中值为9的元素li...
阅读全文
摘要:原文地址:http://docs.pythontab.com/python/python3.4/controlflow.html#tut-functions一个最不常用的选择是可以让函数调用可变个数的参数。这些参数被包装进一个元组(参见元组和序列)。在这些可变个数的参数之前,可以有零到多个普通的参数...
阅读全文
摘要:原文地址:http://docs.pythontab.com/python/python3.4/controlflow.html#tut-functions函数可以通过关键字参数的形式来调用,形如keyword=value。例如,以下的函数:def parrot(voltage, state='a ...
阅读全文
摘要:def fib(n): a,b=0,1 while a<n: print(a,end=" ") a,b=b,a+b print() fib(2000) 输出:0 1 1 2 3 5 8 13 21 34 55 89 144 233...
阅读全文
摘要:打开命令行工具,doc中输入:python -m pydoc -p 4567然后在浏览器中访问http://localhost:4567/,此时应该可以看到python中所有的Modules按ctrl+f,输入selenium,定位到selenium文档的链接,然后点击进入到http://local...
阅读全文