Python: convert string to/from lists


/ Published in: Python
Save to your folder(s)

// Is there a way in python to convert a list say [1,2,3,4] to a string and
// also how to convert a string to a list?

// use str() or repr() to convert to a string.
// eval() will convert back to a list.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.