Skip to content

Instantly share code, notes, and snippets.

@fatosmorina
Created July 25, 2021 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatosmorina/e9e7b0371dfe0bef72347169380d7172 to your computer and use it in GitHub Desktop.
Save fatosmorina/e9e7b0371dfe0bef72347169380d7172 to your computer and use it in GitHub Desktop.
import ast
def string_to_list(string):
return ast.literal_eval(string)
string = "[[1, 2, 3],[4, 5, 6]]"
my_list = string_to_list(string)
print(my_list) # [[1, 2, 3], [4, 5, 6]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment