![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
wenlei_zhouwl
这个作者很懒,什么都没留下…
展开
-
python操作mysql
import MySQLdbconn = MySQLdb.Connection(ip, username, password, database, port)conn.set_character_set("utf8");cur = conn.cursor()cur.execute("select * from table")for data in cur.fetchall():原创 2012-02-20 12:54:37 · 947 阅读 · 0 评论 -
python中文识别
添加#-*- coding: UTF-8 -*-原创 2012-02-20 12:55:58 · 1506 阅读 · 0 评论 -
python获取shell命令返回值
返回shell的输出(不管标准输出或是错误输出)import commandsline = commands.getstatusoutput(shellcommand)line = line[1]原创 2012-02-20 13:14:05 · 9824 阅读 · 0 评论 -
python时间操作
将string转换成struct_timetime.strptime(timeString, "%Y-%m-%d %H:%M:%S")计算两个struct_time类型time1, time2之间的时间差(datetime.fromtimestamp(mktime(endTime)) - datetime.fromtimestamp(mktime(startTime))).se原创 2012-02-20 13:04:46 · 1239 阅读 · 0 评论 -
python捕获异常
try: ......except Exception, why: print sys.exc_info()[0],sys.exc_info()[1]原创 2012-02-21 09:12:43 · 1351 阅读 · 0 评论 -
python 线程中使用os.system
场景:thread中执行os.system("wget ....")指令,wget未执行原因:待解决原创 2012-03-13 11:07:54 · 2389 阅读 · 0 评论 -
python的dictionary(map)实现
转自:http://www.laurentluce.com/posts/python-dictionary-implementation/This post describes how dictionaries are implemented in the Python language.Dictionaries are indexed by keys and they can b转载 2012-05-10 12:53:45 · 4383 阅读 · 0 评论