【问题标题】:Get string from a tweet mentioning a specific user with Twython从使用 Twython 提及特定用户的推文中获取字符串
【发布时间】:2015-01-07 13:50:01
【问题描述】:

我想制作一个机器人,当有人在推文中提到它(@username)时,它会接收推文中的所有文本并查找“开”或“开”或“关”或“关”。我已经设置了 Twython 并让它工作,我知道如何在这里做所有事情,除了从推文中接收文本。

TL;DR 我想从 Twython 的推文中获取文本,但我不知道如何,请帮助

【问题讨论】:

    标签: python python-3.x twitter twython


    【解决方案1】:

    如果您已经拥有推文列表,那么以下可能会对您有所帮助。

    import re
    list = ['This is @brent','This is @alex']
    test = re.compile["@alex",re.IGNORECASE)
    files = [f for f in list if test.search(f)]
    print files
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-16
      相关资源
      最近更新 更多