我已经开始在python中使用pyteserract。当我传递单引号或双引号时
from PIL import Image
import pytesseract
import numpy as np
tesseract_config = r"""-c tessedit_char_whitelist=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#'<>(){};:"""
tesseract_language = "eng"
text = pytesseract.image_to_string(Image.open('res/outc001.jpg'), lang=tesseract_language, config=tesseract_config)
print text
它回来了
^{pr2}$我一直在寻找摆脱单引号和双引号的方法,但没有一个有效。在
当我和泰瑟拉克一样
tesseract res/outc001.jpg tesseract_out/out001 -c "tessedit_char_whitelist=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#\'\"<>(){};:"
它很好用。在
Pytesseract使用shlex分隔配置参数。在
shlex的转义符是
\
,如果要在shlex.split()
函数中插入引号,则必须用\
对其进行转义。在如果您只想
'
出现在白名单中:如果您只想
"
,请:如果您同时想要
'
和"
:或者
相关问题 更多 >
编程相关推荐