Skip to content

Instantly share code, notes, and snippets.

@goyalrohit
Created September 25, 2019 17:57
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 goyalrohit/308a721051db6fe0748fc93ffc69e104 to your computer and use it in GitHub Desktop.
Save goyalrohit/308a721051db6fe0748fc93ffc69e104 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# string representation of a list
strList = "[String, to, List, 1, 2 ,3]"
# # printing string variable and its type
print (strList)
print (type(strList))
# using strip and split and assign to the list variable
listOut = strList.strip('][').split(', ')
# printing list variable and its type
print (listOut)
print (type(listOut))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment