Answers for "python string to list without split"

0

python string to list without split

sentence = 'This is a sentence'
split_value = []
tmp = ''
for c in sentence:
    if c == ' ':
        split_value.append(tmp)
        tmp = ''
    else:
        tmp += c
if tmp:
    split_value.append(tmp)
Posted by: Guest on October-06-2020

Code answers related to "python string to list without split"

Python Answers by Framework

Browse Popular Code Answers by Language