0 votes
1 view
ago in Python by (19.5k points)

How do you convert a string into a list?

Say the string is like text = "a,b,c". After the conversion, text == ['a', 'b', 'c'] and hopefully text[0] == 'a', text[1] == 'b'?

1 Answer

0 votes
ago by (46.1k points)

By using the below-mentioned code you can convert string to a list:-

text = 'a,b,c' 

text = text.split(',')