Python Unicode问题
为什么?Python Unicode问题,python,unicode,Python,Unicode,为什么? 如何返回输出而不让矩形块把一切都弄乱?这与Python无关。控制台窗口呈现Python的输出,这会中断 在控制台窗口中使用支持必要Unicode字符的字体。这与Python无关。控制台窗口呈现Python的输出,这会中断 在控制台窗口中使用支持所需Unicode字符的字体。您打开的字体不正确。Windows中的“Unicode”实际上是UTF-16LE import re ##EDIT didn't mean to copy filename = "rr.txt" ## opens
如何返回输出而不让矩形块把一切都弄乱?这与Python无关。控制台窗口呈现Python的输出,这会中断
在控制台窗口中使用支持必要Unicode字符的字体。这与Python无关。控制台窗口呈现Python的输出,这会中断
在控制台窗口中使用支持所需Unicode字符的字体。您打开的字体不正确。Windows中的“Unicode”实际上是UTF-16LE
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
你开错了。Windows中的“Unicode”实际上是UTF-16LE
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
马克:一个有趣的问题。我怀疑我的答案并不完全正确,但大约90%的答案是正确的(例如,文件采用系统编码而不是UTF-16LE)。感谢您的帮助,Re确实需要一些我现在可以做的工作。谢谢,我想知道如果读错了,正则表达式是如何找到任何东西的?@Mark:一个有趣的问题。我怀疑我的答案并不完全正确,但大约90%的答案是正确的(例如,文件采用系统编码而不是UTF-16LE)。感谢您的帮助,Re确实需要一些我现在可以做的工作。Cheers我使用的文件是一个基本的保存,unicode文本文件,从PDF复制的文本。你怎么知道这个文本文件是unicode的?你用什么操作系统运行Acrobat?在Windows中,它另存为代码页,其中引号为0x93和0x94。保存文本文件时,它提供了编码选项。它们是:ANSI、unicode、unicode大端和UFT-8。我用unicode。。。我在运行Windows我使用的文件是一个基本的保存,unicode文本文件,从PDF复制的文本你怎么知道文本文件是unicode的?你用什么操作系统运行Acrobat?在Windows中,它另存为代码页,其中引号为0x93和0x94。保存文本文件时,它提供了编码选项。它们是:ANSI、unicode、unicode大端和UFT-8。我用unicode。。。我正在运行Windows。上面的问题不是很有帮助,在我看来,这个问题来自于使用python,似乎已经用python解决了。上面的问题不是很有帮助,在我看来,这个问题来自于使用python,似乎已经用python解决了。