Coming from PHP: print_r, var_dump ?

Ok, I'm a very-well-versed web developer in PHP and more.  I've got a new job concentrating on front-end coding, but I have to cross over into some back-end as well, but based in Python not PHP.  I'm a seasoned programmer but new to python so expect me to come back with more questions =)  For now:

PHP has functions that let me easily see the contents of any array, object, etc, etc.  Any variable in fact.  I am speaking of print_r and var_dump . I am aware that at the interactive prompt I can just type a variable name and generally get the same thing, but how do I do that from within a script?
LVL 18
arantiusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rjkimbleCommented:
To see a string representation of x, use:

print x

or:

print repr(x)
arantiusAuthor Commented:
I'm running (for now) PSP based web pages.  Print doesn't go anywhere.  All I can do (that I know how to do, yet) is req.write() which dies if passed anything besides a string.  This executes:

<%
req.write(repr(form))
%>

But displays nothing.
Sandra-24Commented:
>This executes:
>req.write(repr(form))
>But displays nothing.

If it displays nothing it means your variable form has no string representation. What is it?

If it's an object of your creation you'll have to define a __repr__ method.

If it's a python datatype it should display something, even repr(None) displays "None".

-Sandra

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arantiusAuthor Commented:
It's rather long ago for me to remember exactly.  Almost certainly the "form" object.  Probably the stuff I got back for cookies, the objects I got trying to parse XML.
arantiusAuthor Commented:
Not really answered but let's close this 3 month old Q.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.