def load_tweets(filename):
    """Load tweets from file into dict, see save_tweets()."""
    try:
        archive = open(filename,"r")
    except IOError: # no archive (yet)
        return {}

    tweets = {}
    for line in archive.readlines():
        try:
            tid, text = line.strip().split(" ", 1)
            tweets[int(tid)] = text.decode("utf-8")
        except Exception as e:
            err("loading tweet %s failed due to %s" % (line, unicode(e)))

    archive.close()
    return tweets
dataset/ETHPy150Open sixohsix/twitter/twitter/archiver.py/load_tweets/original