Tweepy Tracking Multiple Terms

前端 未结 1 1570
别那么骄傲
别那么骄傲 2021-01-24 08:43

I am doing content analysis on tweets. I\'m using tweepy to return tweets that match certain terms and then writing N amount of tweets to a CSv file for analysis. Creating the f

相关标签:
1条回答
  • 2021-01-24 09:23

    You could check the tweet text against your matching terms. Something like:

    >>> a = "hello this is a tweet"
    >>> terms = [ "this "]
    >>> matches = []
    >>> for i, term in enumerate( terms ):
    ...     if( term in a ):
    ...             matches.append( i )
    ... 
    >>> matches
    [0]
    >>> 
    

    Which would give you all of the terms that that specific tweet, a, matched. Which in this case was just the "this" term.

    0 讨论(0)
提交回复
热议问题