Skip to content
Advertisement

Converting list of lists of strings into integer in Python

I want to convert the string elements to integers within the each following list:

JavaScript

I have tried the following codes:

JavaScript

These are not working in my case. I need the following outputs:

JavaScript

Advertisement

Answer

Try:

JavaScript

You need to use split to parse each long string into small strings, and then apply int to convert a string into an int.

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