pythontwitterpython-twitter

using variable from returns in python


I am currently using python-twitter module and I want to be able to isolate a string from the return I get with api.GetFollowersPaged(). When I run the code to print the return I get something that looks like this:

[User(ID=...., ScreenName=....)]

how could I isolate just the value of either ID or ScreenName and assign it to another variable. I have tried to use

print ScreenName

but recieve a NameError telling me ScreenName is not defined.


Solution

  • I did find a way to do what I was trying to do I switched to tweepy and wrote the following script

    Users = tweepy.Cursor (api.followers, screen_name= whatever).items ()
    while True:
        try:
            User= next (Users)
        except tweepy.TweepError:
            time.sleep (60*15)
            User = next (Users)
        except StopIteration:
            break
       retsn= user.screen_name
       print '@' + retsn
    

    Thanks to everyone for trying to help and hopefully this helps someone someday