Using for in one-liner

Paul Watson pwatson at
Mon Aug 15 18:59:30 CEST 2005

wittempj at wrote:
> to me it seems the ',' is superfluous, this works: python  -c "import
> sys;print ''.join([l for l in sys.stdin.readlines()])" in 2.4.1 - with
> the comma it works as well but it looks weird, as if you want to
> un-pack a tuple.

Without the comma, an additional newline is written at the end.

More information about the Python-list mailing list