+ 3
[SOLVED] I have a problem
I want user input which looks like: 4, 75, 31, 18 to be put in a list as: list = ["4", "75", "31", "18"] or like this: list = [4, 75, 31, 18] But all im getting is something like: list = ["4, 75, 31, 18"] and list = ["4", ",", " ", "7", "5",... and so on.
3 Respuestas
+ 7
Listwhatever=Userinput.split(“,”)
+ 3
Also if you want it in int instead of string.
List1=[int(x) for x in input().split(',')]
+ 2
Thank you syul it works as needed. :)