ruanchao

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

随笔分类 -  Python

摘要:1、文件打开/关闭/读/写 阅读全文
posted @ 2017-02-26 23:26 ruanchao 阅读(153) 评论(0) 推荐(0)

摘要:通过urllib2抓取HTML网页,然后过滤出包含特定字符的行,并写入Excel文件: 输出结果: 阅读全文
posted @ 2016-09-17 16:17 ruanchao 阅读(192) 评论(0) 推荐(0)

摘要:pickle 序列化 阅读全文
posted @ 2016-09-17 14:25 ruanchao 阅读(287) 评论(0) 推荐(0)

摘要:1、安装python 安装目录:D:\Program Files\Python27。 设置环境变量。 2、安装easy_install和pip https://pypi.python.org/pypi/setuptools,下载setuptools;选择Windows (simplified)的ez 阅读全文
posted @ 2016-09-04 23:10 ruanchao 阅读(116) 评论(0) 推荐(0)

摘要:获取变量类型: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,... 阅读全文
posted @ 2015-10-10 11:24 ruanchao 阅读(343) 评论(0) 推荐(0)

摘要:字符串输入:my_string = raw_input("please input a word:")字符串判断:(1)判断是不是纯字母my_string.isalpha()字符串搜索匹配:(1) rere正则表达式实例一:^[\w_]*$首先\w表示匹配包括下划线的任何单词字符,等价于'[A-Za... 阅读全文
posted @ 2015-06-28 23:33 ruanchao 阅读(234) 评论(0) 推荐(0)