【问题标题】:Python regex find a specific wordPython正则表达式查找特定单词
【发布时间】:2022-07-14 21:07:16
【问题描述】:

如何在字符串正则表达式python中查找特定单词 对不起我的英语不好

【问题讨论】:

  • 嗯,你总是可以先看看例子,然后自己试一试。
  • 到目前为止你尝试了什么?

标签: python regex


【解决方案1】:
import re

string = "Hello world"
word = "Hello"

match = re.search(word, string).group()

【讨论】:

    猜你喜欢
    • 2022-08-18
    • 2021-04-20
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多