将 easyocr 的结果保存在 veriable 中,并在同一行打印所有数据
Save result of easyocr in veriable and print it with all data at same line
我正在使用 easyocr 检测护照的 mrz:
.py代码:
import easyocr
import cv2
reader = easyocr.Reader(['en'], gpu=False)
result = reader.readtext(gray)
for detection in result:
text = detection[1]
print(text.upper(), end="")
# PCSDNKHADIGA<ABAKAR<BABIKER<MUS****<<<<<<<<<***************************<<<<<<<<<<<<<<<*
我想将结果保存在变量中,问题是当我使用 's = (text.replace('\n', ''))' 并打印 's' 结果并非全部是同一行喜欢:
PCSDNKHADIGA<ABAKAR<BABIKER
<MUS***<<<<<<<<<
*****************<<<<<<<<<<<<<<<*
如何将所有结果保存到变量,然后在同一行打印?
有什么帮助吗?
使用此代码在单行中获得结果
temp = ''
for detection in result:
text = detection[1]
temp = temp + text.strip() # this will strip spaces at the end .. use it for
# other special characters according to your text.
print(temp.upper(), end="")
我正在使用 easyocr 检测护照的 mrz:
.py代码:
import easyocr
import cv2
reader = easyocr.Reader(['en'], gpu=False)
result = reader.readtext(gray)
for detection in result:
text = detection[1]
print(text.upper(), end="")
# PCSDNKHADIGA<ABAKAR<BABIKER<MUS****<<<<<<<<<***************************<<<<<<<<<<<<<<<*
我想将结果保存在变量中,问题是当我使用 's = (text.replace('\n', ''))' 并打印 's' 结果并非全部是同一行喜欢:
PCSDNKHADIGA<ABAKAR<BABIKER
<MUS***<<<<<<<<<
*****************<<<<<<<<<<<<<<<*
如何将所有结果保存到变量,然后在同一行打印?
有什么帮助吗?
使用此代码在单行中获得结果
temp = ''
for detection in result:
text = detection[1]
temp = temp + text.strip() # this will strip spaces at the end .. use it for
# other special characters according to your text.
print(temp.upper(), end="")