我想要实现能够同时输入多行字符串,当输入为空字符时才会运行后续代码
输入例如:
张三 98
小明 65
我写出的代码是
a = input()
pd = True
while pd:
a += input()
if a[-1] == '':
pd = False
为什么是一直让你输入字符串 运行不了后续代码
我想要实现能够同时输入多行字符串,当输入为空字符时才会运行后续代码
输入例如:
张三 98
小明 65
我写出的代码是
a = input()
pd = True
while pd:
a += input()
if a[-1] == '':
pd = False
为什么是一直让你输入字符串 运行不了后续代码
pd = True
ret_list = []
while pd:
ret = input()
if ret == '':
pd = False
else:
ret_list.append(ret)
print(ret_list)
望采纳