Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Is there a method (similar to str() method in R) that can print thedata structure in python?

Reply
Thread Tools

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

 
 
Peng Yu
Guest
Posts: n/a
 
      09-26-2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com Python 15 09-10-2012 07:16 AM
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments