我搜索了很多,但我找不到解决我的问题,这是我想从输入(文本)搜索一个特定的词。虽然我只找到了第一个字母。 我的代码是:
import re
regex = r"([a-zA-Z]+)"
datm = str(input('Enter a passage to search for a word :'))
if re.search(regex, datm):
match = re.search(regex, datm)
print("Full match: %s" % (match.group(0)))
else:
print("The regex pattern does not match. :(")
谢谢你的回答,如果你要给负数,你不必回答。你知道吗
这对我有用,也许你应该试试。你知道吗
相关问题 更多 >
编程相关推荐