3
votes

I would like to know how to write a simple program that can accept multiple lines of input, then the input can be submitted like in the lynx browser, where you use a blank line and then a period to submit the input.

i want to use it in an email program.

1
This question is a little different, i am asking how to submit the input. - kyle k
Ah, so you already know how to get the multiline input? - TerryA

1 Answers

10
votes

Here's a simple way:

#!/usr/bin/python

input_list = []

while True:
    input_str = raw_input(">")
    if input_str == "." and input_list[-1] == "":
        break
    else:
        input_list.append(input_str)

for line in input_list:
    print line