[IPython-user] Re: String render

Robert Kern rkern at ucsd.edu
Mon Jul 25 10:50:55 CDT 2005


Damien DEGOIS wrote:
> Hello,
> 
> i'd like to know what's the function used to format tuples,dicts, etc
> with indentation when output ex:
> 
> In [16]: a = ['abc','def','ghi','jkl',{'a':1,'b':2,'c':3,'d':4,'e':5,'f':['aze','qsd']},{'aze':123,'eza':654}]
> In [17]: a
> Out[17]: 
> ['abc',
>  'def',
>  'ghi',
>  'jkl',
>  {'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4, 'f': ['aze', 'qsd']},
>  {'aze': 123, 'eza': 654}]
> 
> 
> And i would like to know how i can reuse it in my scripts (is it
> ipython specific or not ?) ?

Look at the pprint module.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the IPython-user mailing list