[python-win32] Converting types for deep lists or Discitonnaries

Tim Roberts timr at probo.com
Thu May 21 19:36:54 CEST 2009


Paul Koning wrote:
>>>>>> "Tim" == Tim Roberts <timr at probo.com> writes:
>>>>>>             
>
>
>  Tim> The string can be converted back to a data structure using eval,
>  Tim> with appropriate caution.
>
> How is that different from the builtin function "repr"?
>   

In this particular case, they happen to produce the same output.  If the
sample data set were larger, you'd see that pprint adds newlines and
white space to make the output line up neatly for human readers, and at
the appropriate indentation level.  repr just makes one big line.

It all depends on what the OP intends to do with the string.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list