Skip to content
Advertisement

How to convert a weird string to integer

Sorry for the possible repeats of the question. I have a weird string, for example:

JavaScript

ps: there is a comma “,” and a space ” ” separating each number. The whole thing is recognized as string. I want to convert it into a list of integers:

JavaScript

Any insights? Thanks in advance.

Advertisement

Answer

Using json.loads()

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement