hello!python!

12 2013 档案

摘要:seek():移动文件读取指针到指定位置 tell():返回文件读取指针的位置 seek()的三种模式: (1)f.seek(p,0) 移动当文件第p个字节处,绝对位置 (2)f.seek(p,1) 移动到相对于当前位置之后的p个字节 (3)f.seek(p,2) 移动到相对文章尾之后的p个字节 c 阅读全文
posted @ 2013-12-26 17:10 你坚持了吗 阅读(23368) 评论(1) 推荐(2) 编辑
摘要:decode 解码encode 转码unicode是一种编码,具体可以百度搜# coding: UTF-8 u = u'汉'print repr(u) # u'\u6c49's = u.encode('UTF-8')print repr(s) # '\xe6\xb1\x89'u2 = s.decode('UTF-8')print repr(u2) # u'\u6c49' # 对unicode进行解码是错误的# s2 = u.decode('UTF-8')# 同样,对str进行编码也是 阅读全文
posted @ 2013-12-20 11:29 你坚持了吗 阅读(2907) 评论(0) 推荐(0) 编辑

hello!python!