摘要:1、文件打开/关闭/读/写
阅读全文
随笔分类 - Python
摘要:通过urllib2抓取HTML网页,然后过滤出包含特定字符的行,并写入Excel文件: 输出结果:
阅读全文
摘要:1、安装python 安装目录:D:\Program Files\Python27。 设置环境变量。 2、安装easy_install和pip https://pypi.python.org/pypi/setuptools,下载setuptools;选择Windows (simplified)的ez
阅读全文
摘要:获取变量类型:print type(42)print type(4.2)print type('spam')if(type(1) == type(2.0)): print "equal"else: print "not equal"list:start_list = [5, 888, 1, 2,...
阅读全文
摘要:字符串输入:my_string = raw_input("please input a word:")字符串判断:(1)判断是不是纯字母my_string.isalpha()字符串搜索匹配:(1) rere正则表达式实例一:^[\w_]*$首先\w表示匹配包括下划线的任何单词字符,等价于'[A-Za...
阅读全文