可能性の重複:私はPythonで、1つの空白に複数の空白を圧縮するにはどうすればよい
Substitute multiple whitespace with single whitespace in Python圧縮の空白
?
text = 'sample base text with multiple spaces'
' '.join(x for x in text.split() if x)
:たとえば
、のは、私は、文字列
"some user entered text"
を持っていると私はそれはあなたがこのようなものを使用することができます
"some user entered text"