随笔分类 -  python

摘要:In [43]: s = 'axxxxxxxxxxxxxxxxxxxxxxxxxxxxx'In [44]: [s[idx:idx+4] for idx in range(len(s)) if idx%4==0]Out[44]: ['axxx', 'xxxx', 'xxxx', 'xxxx', '... 阅读全文
posted @ 2012-03-12 15:59 samlee 阅读(325) 评论(0) 推荐(0)
摘要:#单个unicode字符串的长度为1, 单个utf-8字符的长度为3 In [3]: u = u"这是一个中文字符串"In [4]: len(u)Out[4]: 9In [5]: utf8str = u.encode("utf-8")In [6]: len(utf8str)Out[6]: 27... 阅读全文
posted @ 2012-03-11 16:32 samlee 阅读(2194) 评论(0) 推荐(0)
摘要:1. 问题现象, 通过web.input获取Form提交的请求, 发现后台并没有获取请求,并且通过firebug看到的content-length为0 web.py 代码如下: import weburls = ( '/','Index', '/commit', 'Commit'... 阅读全文
posted @ 2011-10-18 00:05 samlee 阅读(1266) 评论(0) 推荐(0)