“String python Remova o espaço em branco” Respostas de código

Aparelhamento espaços em python de cordas

a = "      yo!      "
b = a.strip() # this will remove the white spaces that are leading and trailing
Super Stoat

Remova todo o espaço em branco do string python

import re
s = '\n \t this is a string   with a lot of whitespace\t'
s = re.sub('\s+', '', s)
Helpful Hippopotamus

Python exclua espaços brancos

sentence = ' hello  apple'
sentence.strip()
>>> 'hello  apple'
Proud Polecat

Remova espaços extras python

>>> import re
>>> re.sub(' +', ' ', 'The     quick brown    fox')
'The quick brown fox'
Worrisome Weasel

Python Remova o espaço em branco do início da string

'     hello world!    '.strip()
'hello world!'


'     hello world!    '.lstrip()
'hello world!    '

'     hello world!    '.rstrip()
'    hello world!'
Breakable Buffalo

String python Remova o espaço em branco

' sss d ssd s'.replace(" ", "")
# output: 'sssdssds' 
David Diamant

Respostas semelhantes a “String python Remova o espaço em branco”

Perguntas semelhantes a “String python Remova o espaço em branco”

Mais respostas relacionadas para “String python Remova o espaço em branco” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código