文章分类 - python
python note
摘要:使用python,是因为他的美;以下说明常用的字符编码在python中的应用:s = "中国a"print repr(s) #输出原始字符 是以十六进制表示# '\xd6\xd0\xb9\xfaa'#Ansi字符串我们最熟悉,英文占一个字节,汉字2个字节,以一个\0结尾,常用于txt文本文件#Unicode字符串,每个字符(汉字、英文字母)都占2个字节,以2个连续的\0结尾#utf-8英文1个字节,中文3个字节s1 = s.decode('gbk') //以十六进制存储就是已经编过码的了 所以要解码#u'\u4e2d\u56fda&#
阅读全文
摘要:str1 = 'md "I:\mr\%s\qjyy" && xcopy /e "E:\学通C++的24堂课\mr\%s\qjyy" "I:\mr\%s\qjyy"'str2 = 'md "I:\mr\%s\sl" && xcopy /e "E:\学通C++的24堂课\mr\%s\sl" "I:\mr\%s\sl"'str3 = 'md "I:\mr\%s\zmhh" &&
阅读全文
摘要:import urllib2import urllibimport reimport sqlite3print 'Create table test'db = sqlite3.connect('test.db')db.row_factory = sqlite3.Rowdb.text_factory = strdb.execute('drop table if exists test')db.execute('create table test (title text, name text)')for j in range(14):
阅读全文