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,870 points
46 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
• 13,160 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
60 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 in Python by Neel
• 3,010 points
26 views
0 votes
1 answer
+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
4,940 views
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,160 points
41 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 223 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,160 points
58 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,160 points
80 views