multiline raw input
Bjorn Pettersen
BPettersen at NAREX.com
Fri Mar 15 18:24:14 EST 2002
> From: les ander [mailto:les_ander at yahoo.com]
>
> Hi,
> i have a program that takes input from the command line
> however this input is multi-line and will have a lot of
> backslashes I tried using sys.stdin but it ignores the
> backslashes. i tried with raw_input but that only takes in
> the first line
>
> can some suggest a remedy?
Something like:
>>> def ml_input():
... res = []
... while 1:
... line = raw_input()
... if line == '.': break
... res.append(line)
... return ''.join(res)
...
>>> ml_input()
This
is a
little
test
.
'This is alittletest'
>>>
-- bjorn
More information about the Python-list
mailing list