Use split()
to split at the commas, use int()
to convert to integer:
user_lst = map(int, user.split(","))
More Related Contents:
- User input integer list [duplicate]
- Change a string of integers separated by spaces to a list of int
- How to convert list of intable strings to int [duplicate]
- What does += mean in this context?
- Most efficient way to build single-element list from string with or without spaces? [closed]
- Convert all strings in a list to int
- Converting a string representation of a list into an actual list object [duplicate]
- TypeError: Can’t convert ‘int’ object to str implicitly
- Loop “Forgets” to Remove Some Items [duplicate]
- Find and replace string values in list
- Converting a String to a List of Words?
- Python split string into multiple string [duplicate]
- Confused about __str__ on list in Python [duplicate]
- How do I convert a list into a string with spaces in Python?
- How does my input not equal the answer?
- Finding a substring within a list in Python [duplicate]
- Perform a string operation for every element in a Python list
- ValueError: invalid literal for int() with base 10: ‘stop’
- Convert list of strings to dictionary
- Replace special characters in a string in Python
- Sort list of strings by a part of the string
- How to create a list with the characters of a string? [duplicate]
- Python: How to check a string for substrings from a list? [duplicate]
- Convert a columns of string to list in pandas
- How to apply __str__ function when printing a list of objects in Python [duplicate]
- How to sort a list of strings in reverse order without using reverse=True parameter?
- How does str.startswith really work?
- How to test if every item in a list of type ‘int’?
- Join a list of strings in python and wrap each string in quotation marks
- Length of longest word in a list