Python默认遇到回车的时候,输入结束。所以我们需要更改这个提示符,在遇到空行的时候,输入才结束。
相关推荐:《Python教程》
raw_input就是从标注输入读取输入,输入的是什么就是什么。
文档解释:
The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that.
stopword=''#输入停止符 str='' forlineiniter(raw_input,stopword):#输入为空行,表示输入结束 str+=line+'\n' #print(str)#测试用
上一篇