用python處理時間、utf8文字、正則匹配、序列化、目錄路徑搜尋、xml解析
阿新 • • 發佈:2019-01-06
python 處理時間
1 import time 2 import re 3 now = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) 4 timeobj = re.match(r'(.*)-(.*)-(.*) (.*):(.*):(.*)', now) 5 if timeobj is not None: 6 timestamp = time.mktime(time.strptime(now, "%Y-%m-%d %H:%M:%S")) 7 date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp))
CentOS升級python到2.7版本
http://my.oschina.net/zhangdapeng89/blog/86134
How to Use UTF-8 with Python
http://www.evanjones.ca/python-utf8.html
python 讀取並顯示 UTF-8 中文文字
http://www.cnblogs.com/mapig/archive/2009/08/07/1541442.html
Python中文全攻略
http://www.sqlite.com.cn/MySqlite/11/395.Html
用多個分隔符正則匹配分割字串
http://bbs.chinaunix.net/thread-1821763-1-1.html
python 正則匹配中文
http://www.blogjava.net/Skynet/archive/2009/05/02/268628.html
序列化Python物件
http://woodpecker.org.cn/diveintopython3/serializing.html
python 處理os路徑
1 import sys 2 import os 3 if not os.path.exists('./directory/'): 4 os.makedirs('./directory/') 5 f = open('./directory/file', 'a') 6 f.write('text\n') 7 f.close()
python os.path模組學習
http://www.redicecn.com/html/Python/20110507/273.html
python 解析xml
https://docs.python.org/2/library/xml.etree.elementtree.html#module-xml.etree.ElementTree