摘要: python 列表方法1、list.append(x) 添加一个元素到列表的末尾;相当于a[len(a):] = [x]。>>> list1 = range(5)>>> list1[0, 1, 2, 3, 4]>>> list1.append('a')>>> list1[0, 1, 2, 3, 4,... 阅读全文
posted @ 2015-07-20 00:57 蛇吞象 阅读(242) 评论(0) 推荐(0) 编辑
摘要: python 字符串1、索引>>> s = range(1,10)>>> s[1, 2, 3, 4, 5, 6, 7, 8, 9]>>> s[0]1>>> s[5]6>>> s[-1]9>>> s[-3]72、切片>>> s = range(1,10)>>> s[1, 2, 3, 4, 5, 6, ... 阅读全文
posted @ 2015-07-20 00:12 蛇吞象 阅读(166) 评论(0) 推荐(0) 编辑
摘要: python 序列序列(sequence)是一组有顺序的对象的集合N == 序列的长度 == len(sequence)常用的序列有:字符串、列表、元组1、序列类型操作符成员关系操作符 (in, not in)>>> a = 'ajdlks'>>> print 'a' in aTrue2、连接操作符... 阅读全文
posted @ 2015-07-19 23:42 蛇吞象 阅读(154) 评论(0) 推荐(0) 编辑
摘要: python for语句for 循环会访问一个可迭代对象(例如序列或是迭代器)中的所有元素, 并在所有条目都处理过后结束循环. 它的语法如下:for iter_var in iterable: suite_to_repeat每次循环, iter_var 迭代变量被设置为可迭代对象(序列, 迭代器,... 阅读全文
posted @ 2015-07-19 23:25 蛇吞象 阅读(159) 评论(0) 推荐(0) 编辑
摘要: python while语句 while 循环的语法如下:while expression: suite_to_repeat while 循环的 suite_to_repeat 子句会一直循环执行, 直到 expression 值为布尔假. 1、计数循环a = 0while a < 10: ... 阅读全文
posted @ 2015-07-19 23:06 蛇吞象 阅读(197) 评论(0) 推荐(0) 编辑
摘要: python if语句1、一般形式if a > b: print a2、if...else...语句if a > b: print aelse: print b3、多重条件表达式(and,or, not)if a > b and a > c: print a4、elif(即 else... 阅读全文
posted @ 2015-07-19 22:51 蛇吞象 阅读(163) 评论(0) 推荐(0) 编辑
摘要: python中要显示中文时,要加上如下语句:#coding=utf-8或者:# -*- coding:utf-8 -*- 可在汉字前加u,如:u'要输出的汉字' 阅读全文
posted @ 2015-07-19 22:11 蛇吞象 阅读(242) 评论(0) 推荐(0) 编辑
摘要: Python + Selenium 环境搭建注:本文是根据网上资料收集验证整理而得,仅供学习准备如下:1、下载 pythonhttp://python.org/getit/2、下载 setuptoolshttp://pypi.python.org/pypi/setuptools3、下载 piphtt... 阅读全文
posted @ 2015-07-16 21:32 蛇吞象 阅读(599) 评论(0) 推荐(0) 编辑