0
How do you take multiple inputs in same line?
for eg. i do name=[int(x) for x in input ().split ()] i would like to know is there any better way to do the same?
1 Respuesta
+ 2
I would just do it more secure but it is basically the same ^^
l = input().split(" ")
res = []
for i in l:
try:
if i[-1] in ",;":
res.append(int(i[:-1]))
else:
res.append(int(i))
except:
#here you handle errors
pass