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,890 points
61 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,230 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
87 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,010 points
63 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
• 2,980 points
29 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,230 points
58 views
0 votes
1 answer
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 511 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,230 points
79 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,230 points
124 views