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 in Python by ana1504.k
• 7,470 points
37 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 by SDeb
• 12,360 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
53 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 5 days ago in Python by Neel
• 1,610 points
11 views
+4 votes
7 answers

Splitting a List into chunks in Python

Here's a generator that yields the chunks ...READ MORE

answered Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
3,063 views
+1 vote
3 answers
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
• 12,360 points
31 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 132 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
• 12,360 points
51 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
• 12,360 points
64 views