How to remove white spaces at start and end of string in Python

1 Answer

0 votes
s = '    python programming         '

print(s)
print(len(s))

s = s.strip()

print(s)
print(len(s))



'''
run:

    python programming         
31
python programming
18

'''

 



answered Oct 25, 2020 by avibootz

Related questions

2 answers 109 views
1 answer 179 views
1 answer 144 views
1 answer 128 views
1 answer 223 views
1 answer 169 views
...