TP wrote:
Hi everybody,

When using raw_input(), the input of the user ends when he types Return on
his keyboard.
How can I change this behavior, so that another action is needed to stop the
input? For example, CTRL-G. It would allow the user to input several lines.

Thanks

Julien


Just put raw_input() in a loop and check for something. Actually a blank line would probably work best in that case. Not tested, but you will get the idea:

lines = list()
print 'Enter your text (empty line to quit)'
while 1:
    line = raw_input('')
    if line.strip() == '':
        break

    lines.append(line)



-Larry
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to