+ 5

How to convert string "" into list [""] ?

Been making a function that takes a string as an input and make it into a list of words using split() method like that: string_a = "I want to be a coder." list_a = ["I", "want", "to", "be", "a", "coder."] And my problem is, when I call the function this way: my_func("") it will make this [] but I want it to make it this [""] How can I tell python to treat "" as a word and place it into the new list?

9th Mar 2017, 12:39 AM
Martin Cupak
Martin Cupak - avatar
3 Respuestas
+ 3
Thanks!
9th Mar 2017, 2:01 AM
Martin Cupak
Martin Cupak - avatar
+ 2
here I wrote : https://code.sololearn.com/cMkC7qZ9TuHJ/?ref=app let me know what else you want
9th Mar 2017, 1:22 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
glad I could help you..keep learning.
9th Mar 2017, 2:44 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar