摘要: 正则表达式用于字符串处理、表单验证、日志数据分析等场合,实用高效。现将自己走网上搜索并总结的常用方法收集了一下: 匹配中文字符的正则表达式: [\u4e00-\u9fa5]注:匹配中文还真是个头疼的事,有了这个表达式就好办了 匹配双字节字符(包括汉字在内):[^\x00-\xff]注:可以用来计算字 阅读全文
posted @ 2016-05-22 21:20 Alien_Lee 阅读(203) 评论(0) 推荐(0) 编辑
摘要: s为字符串 s.isalnum() 所有字符都是数字或者字母 s.isalpha() 所有字符都是字母 s.isdigit() 所有字符都是数字 s.islower() 所有字符都是小写 s.isupper() 所有字符都是大写 s.istitle() 所有单词都是首字母大写,像标题 s.isspa 阅读全文
posted @ 2016-05-14 18:10 Alien_Lee 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 创建列表sample_list = ['a',1,('a','b')] Python 列表操作sample_list = ['a','b',0,1,3] 得到列表中的某一个值value_start = sample_list[0]end_value = sample_list[-1] 删除列表的第一 阅读全文
posted @ 2016-04-22 04:46 Alien_Lee 阅读(159) 评论(0) 推荐(0) 编辑
摘要: jieba结巴 github上已经够详细了https://github.com/vinta/awesome-python 阅读全文
posted @ 2016-04-22 02:00 Alien_Lee 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1 政府数据 Data.gov:这是美国政府收集的数据资源。声称有多达40万个数据集,包括了原始数据和地理空间格式数据。使用这些数据集需要注意的是:你要进行必要的清理工作,因为许多数据是字符型的或是有缺失值。 Socrata:它是探索政府相数据的另一个好地方。Socrata的一个了不起的地方是,他们 阅读全文
posted @ 2016-04-22 01:52 Alien_Lee 阅读(496) 评论(0) 推荐(0) 编辑
摘要: "显示行数,设置软回车和缩进还有语法set numberset expandtabset tabstop=8set shiftwidth=4set softtabstop=4set autoindent:syntax on"补全设置,不设也能用let Tlist_Ctags_Cmd='/usr/bi 阅读全文
posted @ 2016-04-18 19:24 Alien_Lee 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1.如何循环获得下标,使用 enumerate 结果: 0 a1 b2 c3 d4 e5 f 2.python 中的switch 替代语法,使用字典 结果: 100 100 3.如何在非创建全局变量的时候使用全局变量,使用global关键字 结果为10 4.为什么是string.join(list) 阅读全文
posted @ 2016-03-25 03:36 Alien_Lee 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 1、创建数据库CREATE DATABASE database-name 2、删除数据库drop database dbname 4、说明:创建新表create table tabname(col1 type1 [not null] [primary key],col2 type2 [not nul 阅读全文
posted @ 2016-03-22 19:57 Alien_Lee 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 一、ubuntu16下: 用sudo apt install安装python-dev,pip 用pip安装easy_install :pip install setuptools ipython、bpython 各种包安装,(以numpy为例) 方法一、sudo apt install python 阅读全文
posted @ 2016-03-22 17:19 Alien_Lee 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 一、数据结构 C++STL查询: http://www.cplusplus.com/ 数据结构可视化:http://www.cs.usfca.edu/~galles/visualization/Algorithms.html http://www.comp.nus.edu.sg/~stevenha/ 阅读全文
posted @ 2016-03-22 16:33 Alien_Lee 阅读(279) 评论(0) 推荐(0) 编辑