Given:
xs = ['1', '2', '3']
Use map
then list
to obtain a list of integers:
list(map(int, xs))
In Python 2, list
was unnecessary since map
returned a list:
map(int, xs)
More Related Contents:
- From list of integers, get number closest to a given value
- Call int() function on every list element?
- converting a list of integers into range in python
- How to convert a string of space- and comma- separated numbers into a list of int? [duplicate]
- Splitting List That Contains Strings and Integers
- Converting integer to digit list
- How can I convert string values from a dictionary, into int/float datatypes?
- Convert a number to a list of integers [duplicate]
- How do I add together integers in a list (sum a list of numbers) in python?
- How to combine lists? (Python) [duplicate]
- Split a Pandas column of lists into multiple columns
- How to check if all elements of a list match a condition?
- Check for presence of a sliced list in Python
- How to do a recursive sub-folder search and return files in a list?
- List of lists into numpy array
- Replace values in list using Python [duplicate]
- Pandas DataFrame to List of Dictionaries
- Add SUM of values of two LISTS into new LIST
- Splitting list based on missing numbers in a sequence
- Using an index to get an item
- Some built-in to pad a list in python
- Sort a list of lists with a custom compare function
- Python – sum values in dictionary
- Convert list into a pandas dataframe
- Why does list ask about __len__?
- How to assign each element of a list to a separate variable? [duplicate]
- How to subclass Python list without type problems?
- Appending to 2D lists in Python [duplicate]
- Creating a list in Python with multiple copies of a given object in a single line
- How can I turn a flat list into a 2D array in python?