python实战练习:对哪部分使用类型转换

limalove / 2023-08-14 / 原文

 

 

 

 

 

l = []
while True:
    s = input()
    if s == '0':  #注意:这里是对0加引号,而不是使用int(s),如果输入'hello',int(s)会报错,所以是用字符串'0'
        break
    else:
        l.append(s)


print(" ".join(l))