Masklinn,

Thanks. I see what you mean about being bored!  But that's a big step
forward for me.

As a PHP convert to Django/Python, I'm looking for the equivalent of
print_r

On May 9, 4:31 pm, Masklinn <maskl...@masklinn.net> wrote:
> On 9 May 2009, at 16:37 , phoebebright wrote:
>
> > Not looking for a discussion on debug methods, just want to know if
> > there is any way to print an object.
>
> > eg. print myobject  OR  pprint.pprint(myobject)
>
> > just says something like
>
> > <django.forms.models.ModelChoiceField object at 0x1dc8eb0>
>
> > And unless I know the structure of the object I can't access the
> > values.
>
> > I'm probably going to get a blasting for not understanding how python
> > works, but there we go!
>
> You can print its __dict__ attribute if you're really bored. If it's  
> an object you created, correctly override the corresponding magic  
> methods (__str__, __repr__, ...)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to