split string python without space code example
Example 1: python replace space with underscore
mystring.replace(" ", "_")
Example 2: 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)