BranoZ wrote:
> Paul Watson wrote:
>> Using a '$' before the string works in the ksh that is part of FC4.
>> However, it does not work on the pdksh that is in FC3 and Cygwin. It
>> also does not work on AIX ksh.
>>
>> $ print $'now'
>> $now
>
> In bash you can also use Ctrl-v followed by special
Paul Watson wrote:
> Using a '$' before the string works in the ksh that is part of FC4.
> However, it does not work on the pdksh that is in FC3 and Cygwin. It
> also does not work on AIX ksh.
>
> $ print $'now'
> $now
In bash you can also use Ctrl-v followed by special character.
(I used to rese
BranoZ wrote:
> In "man python"
> "Here command may contain multiple statements separated by
> newlines. Leading whitespace is significant in Python statements!"
>
> In "man bash" search for \n (/\\n)
> Frankly, I know bash for 10 years, but this has surprised me, too.
>
> BranoZ
Using a '$' be
In "man python"
"Here command may contain multiple statements separated by
newlines. Leading whitespace is significant in Python statements!"
In "man bash" search for \n (/\\n)
Frankly, I know bash for 10 years, but this has surprised me, too.
BranoZ
--
http://mail.python.org/mailman/listinfo/
BranoZ wrote:
> Paul Watson wrote:
>
>>Can a for loop be used in a one-liner? What am I missing?
>>
>>$ python -c "import sys;for i in range(5): print i,"
>> File "", line 1
>> import sys;for i in range(5): print i,
>> ^
>>SyntaxError: invalid syntax
>
>
> This was tricky
[EMAIL PROTECTED] 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 i
Paul Watson wrote:
> Can a for loop be used in a one-liner? What am I missing?
>
> $ python -c "import sys;for i in range(5): print i,"
>File "", line 1
> import sys;for i in range(5): print i,
> ^
> SyntaxError: invalid syntax
This was tricky..
python -c $'import sys;
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.
--
http://mail.python.org/mailman/listinfo/python-list
Can a for loop be used in a one-liner? What am I missing?
$ python -c "import sys;print ''.join([line for line in
sys.stdin.readlines()]),"
now is
the time
now is
the time
$ python -c "import sys;for line in sys.stdin.readlines(): print line,"
File "", line 1
import sys;for line in sys.