Python, convert an integer into an index?

jmp jeanmichel at sequans.com
Thu Sep 24 10:14:02 EDT 2015


On 09/24/2015 03:45 PM, paul.hermeneutic at gmail.com wrote:
>  >> I'm suprised. Why not just:
>  >>
>  >> list(str(results))
>  >>
>  >> In other words, is there something else the list constructor should do
>  >> with a string other than convert it to a list?
>  >>
>  > The OP wanted the result to be a list of ints, not a list of strings.
>
> [int(x) for x in list(str(results))]

Side note : strings are already iterable, the list function is superfluous.


jm





More information about the Python-list mailing list