In this article we will see how we can get the screen name of a user. Screen name is the username of the twitter account. It is the name that users choose to identify themselves on the network. Many users choose to either use their real name as the basis for their screen name, often in a shortened version. All the screen names must be unique.
Identifying the screen name in the GUI :
In the above mentioned profile, geeksforgeeks is the screen name of the profile.
In order to get the screen name we have to do the following :
- Identify the user ID of the profile.
- Get the User object of the profile using the
get_user()method and the user ID.
- From this object, fetch the screen_name attribute present in it.
Example 1: Consider the following profile :
The user ID of the above mentioned profile is 57741058.
The screen name of the user is : geeksforgeeks
Example 2: Consider the following profile :
The user ID of the above mentioned profile is 4802800777.
The screen name of the user is : PracticeGfG
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.