splitting and concatenating a string

0 votes
I wanted to know if python had a built in function similar to:

string->list
 

and

list->string in scheme.

So What should I do if I want to turn 'abc' into ['a','b','c'] and vice versa using a built in function?
Apr 17, 2019 in Python by ana1504.k
• 7,910 points
946 views

1 answer to this question.

0 votes
You can try the following code in order to convert from String to list:

>>> list('abc')
['a', 'b', 'c']
 

And for List to string:

>>> ''.join(['a', 'b', 'c'])
'abc'
answered Apr 17, 2019 by SDeb
• 13,300 points

Related Questions In Python

0 votes
2 answers

Splitting a Python String

The split() method in Python returns a ...READ MORE

answered Oct 3, 2018 in Python by anonymous
691 views
0 votes
1 answer

Is it possible to print a string and a variable in a single print statement in Python?

This can be done using simple string ...READ MORE

answered Jul 15, 2019 in Python by Neel
• 3,020 points
828 views
0 votes
1 answer

Is it possible to read a text file into a string variable and then scrap the newlines?

This can be done easily in Python. ...READ MORE

answered Aug 7, 2019 in Python by Arvind
• 3,050 points
1,731 views
+1 vote
1 answer
0 votes
1 answer

How do I append one string to another in Python?

If you only have one reference to ...READ MORE

answered Oct 22, 2018 in Python by SDeb
• 13,300 points
739 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer

Is there a string 'contains' in python?

In this case, you can use the ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,300 points
696 views
0 votes
1 answer

How to convert a Unicode string to string

It can be done in the following ...READ MORE

answered Oct 16, 2018 in Python by SDeb
• 13,300 points
1,252 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP