我对 python 有点陌生,我试图用格式化的字符串填充 raw_input,但我的输出永远不会改变“\n”字符并且总是返回 null。有没有办法通过空变量抽取完全格式化的字符串/文本?
text = ""
stop = "|"
while True:
text_1 = raw_input()
text += "%s" % (text1)
if text_1 != stop:
pass
else:
break
print text
output:
hello world
how are you
|
hello worldhow are you|
需要:你好,你好吗?