Answers for "split string python without space"

2

python replace space with underscore

mystring.replace(" ", "_")
Posted by: Guest on April-29-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language