0
import re

##EDIT  didn't mean to copy filename = "rr.txt" ## opens file unicode file type
buffer = open('r.txt','r').read()

quotes = re.findall(ur'"[^"^\u201c]*["\u201d].*', buffer)
for quote in quotes:
    print ''
    print quote
## prints quotes found
## Problem is that the print output has rectangular blocks between each Character 

なんで?

長方形のブロックがすべてを台無しにすることなく、どのように出力を返しますか?

4

2 に答える 2

4

間違って開いています。Windows の「Unicode」は実際には UTF-16LE です。

buffer = codecs.open('r.txt', 'r', encoding='utf-16le').read()
于 2012-05-11T15:10:48.537 に答える
2

これは Python とは関係ありません。コンソール ウィンドウに Python の出力が表示され、これが壊れます。

必要な Unicode 文字をサポートするコンソール ウィンドウでフォントを使用します。

于 2012-05-11T15:04:16.560 に答える