A Byte of my 2.2-lb Brain

Just sharing stuff…

Finding all hashtags in a list of tweets

import re
r = re.compile(r"([#$])(\w+)\b")

taggedwords = []

for tweet in tweets:
    tagged = r.findall(tweet)
    if tagged:
        for word in tagged:
            taggedwords.append(word[1])

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on June 15, 2015 by in Geek and tagged , , .
%d bloggers like this: