Barry Barry - 1 year ago 207
Python Question

How to get screen name instead of user ID with tweepy

I'm printing out the tweets from my twitter feed to a CSV and want to get the CSV to show the username instead of the user ID.

My code uses tweepy.

outtweets.append([tweet.id_str, tweet.created_at, tweet.text.encode("utf-8")])

This is what I use in my loop to get the user ID.
How would I go about to get the screen name instead?

Answer Source

See Tweet object and User object.

This will reveal that you need to use:

to access the user name

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download