python 迭代器案例

endstr = "end"
str = ""
for line in iter(input, endstr):
str += line + "\n"
print(str)
输入end才会结束循环
posted @ 2020-01-30 15:48  i勤能补拙  阅读(307)  评论(0编辑  收藏  举报