Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:14:04+00:00 2026-06-10T05:14:04+00:00

I am wokring in python 2.7. I have been experimenting with the tweepy package.

  • 0

I am wokring in python 2.7. I have been experimenting with the tweepy package. There is an object called the tweepy.models.status object, whose function is defined here: https://github.com/tweepy/tweepy/blob/master/tweepy/models.py.

I have a function that looks like this:

    def on_status(self, status):
        try:
            print status
            return True
        except Exception, e:
            print >> sys.stderr, 'Encountered Exception:', e
            pass

The object I am referring to is the one returned from the on_status function, called status. When the print status line executes i get this printed on the screen;

tweepy.models.Status object at 0x85d32ec>

My question is actually pretty generic. I want to know how to visually print out the contents of this status object? I want to know what information is available inside this object.

I tried the for i, v in status : approach, but it says this objects is not iterable. Also not all of the object attributes are described in the function definition.

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:14:06+00:00Added an answer on June 10, 2026 at 5:14 am

    You could iterate over status.__dict__.items():

    for k,v in status.__dict__.items():  #same thing as `vars(status)`
        print k,v
    

    The above approach won’t work if the class uses __slots__ and doesn’t have a slot for __dict__. Classes with __slots__ are quite rare though, so it’s unlikely to be a problem.

    Alternatively, you could use the dir builtin with getattr:

    for attr in dir(status):
        print attr, getattr(status,attr)
    

    This does work for classes with __slots__, but has some limitations if a custom __getattr__ is defined (see link, and __dict__ would suffer in the same way).

    Finally, if you want really fine control over what you see (e.g. if you only want methods), you can check out some of the goodies in the inspect module.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a recursively defined list class in Python and I'm
I am currently working with Python and have been confused over the fact that
I'm working on my first object oriented bit of python and I have the
I am working with datetime objects in python. I have a function that takes
I have been programming using Python for slightly more than half an year now
I just started working on Python and have been trying to run an outside
I am new to python and have been working through the examples in Swaroop
I'm new to Python (I have been programming in Java for multiple years now
I have been working on Learn Python the Hard Way 2nd Ed and it
I am working in a Python program with Javascript and DB. I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.