Answers for "how to remove all white spaces in a string in python"

11

python delete white spaces

sentence = ' hello  apple'
sentence.strip()
>>> 'hello  apple'
Posted by: Guest on May-08-2020
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
0

remove trailing white space python string

vals_inp=input() 
list_set = list(vals_inp) 
vals = [x for x in list_set if x != ' '] 
set_vals = set(vals)
Posted by: Guest on October-24-2021

Code answers related to "how to remove all white spaces in a string in python"

Python Answers by Framework

Browse Popular Code Answers by Language