Answers for "python remove all spaces"

2

how to remove all spaces from a string in python

string = "Hello, world! Some more text here..." # Just a string
string.replace(" ", "") # Replaces all instances of " " (spaces)with "" (nothing)

# string is now "Hello,World!Somemoretexthere..."
# I hope I helped you! ;)
Posted by: Guest on March-11-2021
4

remove all whitespace from string python

import re
s = 'n t this is a string   with a lot of whitespacet'
s = re.sub('s+', '', s)
Posted by: Guest on August-03-2020
3

remove extra spaces python

>>> import re
>>> re.sub(' +', ' ', 'The     quick brown    fox')
'The quick brown fox'
Posted by: Guest on July-14-2020
4

trimming spaces in string python

a = "      yo!      "
b = a.strip() # this will remove the white spaces that are leading and trailing
Posted by: Guest on June-20-2020
3

python remove spaces

string=' t e s t ' 
print(string.replace(' ',''))
Posted by: Guest on October-14-2020
0

remove space in print python

print('My age is "{}"'.format(20))
Posted by: Guest on June-17-2021

Code answers related to "python remove all spaces"

Python Answers by Framework

Browse Popular Code Answers by Language