Differences between revisions 1 and 2
Revision 1 as of 2008-03-03 15:18:17
Size: 836
Editor: ZoomQuiet
Comment:
Revision 2 as of 2008-04-09 06:16:48
Size: 883
Editor: ZoomQuiet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from MicroProj/2008-03-03

含有章节索引的 *PUG 文章通用模板 ::-- ZoomQuiet [DateTime(2008-03-03T15:18:17Z)] TableOfContents

Include(CPUGnav)

1. 文件编码问题~通解

   1 f = file(...)
   2 t = open(..,'w')
   3 t.write(f.read())
  • 有时候会报错或者写入t中时成乱码
  • 这些都是因为编码不统一造成
  • 有没有一般性的方法解决这种问题呢

For simple pass-through read-write, why not use binary mode? --

   1 # Note: just for illustration, this naive approach breaks when
   2 # the input file is larger than your physical memory
   3 fp = open('input', 'rb')
   4 tp = open('output', 'wb')
   5 tp.write(fp.read())

Jerry

PageComment2 [:/PageCommentData:PageCommentData]

MiscItems/2008-03-03 (last edited 2009-12-25 07:15:15 by localhost)