print is not a function

Wolfram Kraus kraus at hagen-partner.de
Thu Oct 9 04:02:54 EDT 2003


Heyho!

Karl Scalet wrote:
[...]
> For interactively inspecting things, I think
> having it in one line is nice, as it's
> easiest to recall from commandline history.
> 
> Which way?:
>  >>> [ pprint(x) for x in locals() if x[:3]=='QAc' ]
> or
>  >>> for x in locals():
>  >>>     if x[:3] == 'QAc':
>  >>>         print x
> 
> I cannot put this second one in a single line, so I
> will stay with my list-comprehension-solution unless
> I'm getting a better idea.
> 
> Karl
> 

Why don't you wrap it in a function and put it in your 
$PYTHONSTARTUP-file? That way you can call it very fast and don't need 
to remember a one-liner.

Wolfram





More information about the Python-list mailing list