2011-07-07から1日間の記事一覧
Windowsで "\x1a" を含むテキストファイルをCPythonに読ませると、途中で読み込みが停止してしまうようだね。 # CPython 2.7.2 on Win32 with open('a.txt', 'wb') as fout: fout.write("abc\x1adef") with open('a.txt', 'r') as fin: print fin.read() # …
Windowsで "\x1a" を含むテキストファイルをCPythonに読ませると、途中で読み込みが停止してしまうようだね。 # CPython 2.7.2 on Win32 with open('a.txt', 'wb') as fout: fout.write("abc\x1adef") with open('a.txt', 'r') as fin: print fin.read() # …