stri = ''
try:
    for line in iter(input, stopword):
        stri += line + '\n'
except EOFError:
   pass
stri = stri[0:-1]
# do something……```

其中,stopword代表空字符船:当读取到最后一行之后,我们继续读取input就是空字符串,此时停止读取。
下面是python中自带iter的函数。第二个参数stopword的作用是停止符。

```def iter(source, sentinel=None): # known special case of iter
    """
    iter(iterable) -> iterator
    iter(callable, sentinel) -> iterator
    
    Get an iterator from an object.  In the first form, the argument must
    supply its own iterator, or be a sequence.
    In the second form, the callable is called until it returns the sentinel.
    """
    pass```

潜下心,沉住气。