felix001 felix001 - 1 month ago 7x
Python Question

Raw input across multiple lines in Python

Does anyone know how to create a raw input that will take multiple lines ?

sentinel = '' # ends when this string is seen
for line in iter(raw_input, sentinel):
    pass # do things here

To get every line as a string you can do:

'\n'.join(iter(raw_input, sentinel))

Python 3:

'\n'.join(iter(input, sentinel))