📜  python string to list without split - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:24.534000             🧑  作者: Mango

代码示例1
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)