sys.stdin.readline()

SBrunning at trisystems.co.uk SBrunning at trisystems.co.uk
Wed Sep 1 08:12:18 EDT 2004


> From: aleaxit at yahoo.com [mailto:aleaxit at yahoo.com]
> 
> No, I think you're correctly observing that Python isn't oriented to
> one-liners -- not at all.  Most interesting things in Python require
> more than one line.  You could write a "oneliners shell" that 
> takes some
> defined separator and turns it into a newline, of course, e.g.:
> 
> bangoneliner.py:
>     #!/usr/bin/env python
>     import sys
>     oneliner = sys.argv.pop(1)
>     exec '\n'.join(oneliner.split('!'))

Check out PyOne[1]. It's a somewhat more sophisticated implementation of
this idea.

Cheers,
Simon B.
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/ 

[1] http://www.unixuser.org/~euske/pyone/




-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.



More information about the Python-list mailing list