Newby: What's the problem with this string?
Christos TZOTZIOY Georgiou
DLNXPEGFQVEB at spammotel.com
Tue Jun 11 04:19:53 EDT 2002
On 10 Jun 2002 13:04:18 GMT, rumours say that fishfinger
<deathtospam43423 at altavista.com> might have written:
>For some reason I can't read this string from the command line ...
[snip of multi-line string]
>Why is that? And how can I make it work properly? The method I'm using is
>.......
>
>ttt = raw_input("a string:")
raw_input stops reading as soon as you press the Return / Enter key.
IIUC, you need to ask for more lines until some predefined condition is
met. The following returns a multiline string (keeps asking for more
until you input a single period):
# tested python>=2.2.1
def raw_multi_input(prompt):
prompted_input= lambda: raw_input(prompt)
input_lines= []
for input_line in iter(prompted_input, "."):
input_lines.append(input_line)
return '\n'.join(input_lines)
--
TZOTZIOY, I speak England very best,
Real email address: 'dHpvdEBzaWwtdGVjLmdy\n'.decode('base64')
More information about the Python-list
mailing list