Пример #1
0
def listing(feed):
    """
    This is normally called the hashtag (# tag) by twitter
    """
    feed_list = feed.split()
    x = []
    for i in feed_list:
        if i.startswith("#"):
            x.append(punctuation.sub("",i))
        else:
            x.append(None)
    y = []
    for i in x:
        if i != None:
            y.append(i)
    if not y:
        return None
    return y[0] # indexed at zero for testing purposes; this list usually contents other tags... 
Пример #2
0
def twitterSearch(feed):
    """
    A twitter is an entity.. denoted by @<some name> e.g. @vicmiclovich, @cnn, etc.
    """
    feed_list = feed.split()
    x = []
    for i in feed_list:
        if i.startswith("@"):
            x.append(punctuation.sub("",i))
        else:
            x.append(None)
    """Implement the part that should strip off all None values to only keep fixed values"""
    y = []
    for i in x:
        if i != None:
            y.append(i)
    if not y:
        return None
    return y[0] # indexed at zero for testing purposes: How would you store a list of tags?