Skip to content
Advertisement

Convert string array to array of array in python

I have input like this

JavaScript

How to convert it into an array of array in Python like this?

JavaScript

Advertisement

Answer

Use str.split with map :

JavaScript

If you want to convert each item to int:

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