Answers for "how to remove white space or line break in python"

0

how to strip white space of text in python?

sentence = ' hello  apple'
" ".join(sentence.split())
>>> 'hello apple'
Posted by: Guest on March-26-2021
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 white space or line break in python"

Python Answers by Framework

Browse Popular Code Answers by Language