first_len = [15,20,25,30,35]
meas_len = []
meas_len_ipt = input("type 5 values separated by comma:")
meas_len.append(meas_len_ipt)
for fl, ml in list(zip(first_len,meas_len)):
print(fl,ml)
input('Press ENTER to exit')
我打算
15 1
20 2
25 3
30 4
35 5
出现,但结果是
15 1,2,3,4,5
答案 0 :(得分:1)
meas_len_ipt
只是一个字符串。您需要将其拆分为单个元素:
meas_len_ipt = input("type 5 values separated by comma:")
meas_len = meas_len_ipt.split(",")