0 votes
1 view
in Python by (41.8k 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
by (95.7k points)
edited by

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

text = 'a,b,c' 

text = text.split(',') 

print(text) 

image 

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...