['1', '2', '3'] -> [1, 2, 3]
How do I turn a number stored in text into a number?
I think there is a way to do it without using the for statement, but I don't know what to do.
list android-intent python conversion
Usually, int('1')
is used to make 1'
into 1
. Use map() to apply this to the entire list without using for.
map(function, iterable,...) is a function that returns an interpreter that applies function
to all items in iterable
.
results = map(int, results)
© 2024 OneMinuteCode. All rights reserved.