DeprecationWarning:无效的转义序列\ w

时间:2019-04-06 07:25:30

标签: python python-3.x

有人可以帮助我如何替换python 3中的#(\ w +)以使其正常工作吗?或如何使用我的代码解决此问题:

def find_hashtags(self, message):
    return re.findall("#(\w+) ", message)

我很担心:

=============================== warnings summary ===============================
twitter.py:17
  /root/PycharmProjects/learning_pytest/twitter.py:17: DeprecationWarning: invalid escape sequence \w
    return re.findall("#(\w+) ", message)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
===================== 3 passed, 1 warnings in 0.01 seconds =====================

我检查了一些论坛,但不知道如何解决或替换此顺序

0 个答案:

没有答案