Reputation: 9
input comma separated numbers, convert them into integer from string and then into integer list. this is what i came up with. is there any other way?
x = list(map(lambda x : int(x),(input()).split(",")))
print(x)
input : 1,2,3,55,66,714,78
output : [1, 2, 3, 55, 66, 714, 78]
Upvotes: 0
Views: 561
Reputation:
If you don't mind a tuple, you can use eval
eval(input())
1,2,3,55,66,714,78
(1, 2, 3, 55, 66, 714, 78)
Upvotes: 0