我正在尝试将阿拉伯数字与数字匹配,但它不起作用。如果它尝试相同的方法,但没有阿拉伯字符,它可以很好地工作。
<div class="row">
<div class="cell">
<div class="cell">A</div>
</div>
<div class="cell">
<div class="cell">B1</div>
<div class="cell">B2</div>
<div class="cell">B3</div>
</div>
<div class="cell">
<div class="cell">C1</div>
<div class="cell">Very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text</div>
<div class="cell">C3</div>
</div>
</div>
输出为def Replace(text, wordDict):
for key in wordDict:
text = text.replace(key, wordDict[key])
return text
singular = {
"واحد" :"1",
"اثنان" :"2",
"ثلاتة" :"3"
}
s="ثلاثة"
s=Replace(s,singular)
print(s)
,但它应为3,这意味着未执行替换操作。
有什么想法吗?