Is there a method (similar to str() method in R) that can print thedata structure in python?

P

Peng Yu

Hi,

I am looking for a method in python that is similar to the function
str() in R, if you are familiar with R,

If you have no idea of R, what I want is to print the class
information of an object and the values of its members. Overloading
'__expr__' and '__repr__' then using 'print' can sort of do what I
want. But not quite. For example, if I have a list of many elements, I
don't want to print all the elements. R's str() function can
automatically take care of this issue. It also has other advantages, I
am wondering if there is something similar available in python?

Regards,
Peng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top