list_less_than_or_equal = ['less than or equal', 'lesser than or equal', 'lower than or equal', 'smaller than or equal','less than or equals', 'lesser than or equals', 'lower than or equals', 'smaller than or equals', 'less than equal', 'lesser than equal', 'higher than equal','less than equals', 'lesser than equals', 'higher than equals']
if any(word in 'When the loan amount is smaller than or equal to 50000' for word in list_less_than_or_equal):
print("yep");
else:
print("nope");
如果备选方法是选项,则可以将列表与列表进行比较:
或正则表达式:
^{pr2}${可以使用字符串}代替连接。在
你在第二个
'\b'
中忘了一个r
。在escape sequence ^{} 在Python中有特殊的含义,它将变成
\x08
(U+0008)。看到\x08
的正则表达式引擎将尝试匹配此文本字符,但失败。在另外,我使用^{} 来转义特殊的正则表达式字符,因此,例如,如果一个单词是
"etc. and more"
,则点将按字面匹配,而不是匹配任何字符。在相关问题 更多 >
编程相关推荐