What is the equivalent of PHP trim() in Python

1 Answer

0 votes
s = '   python programming    '

s = s.strip()

print(s)

s = "'" + s + "'"

print(s)
 

      
      
'''
run:
      
python programming
'python programming'
      
'''

 



answered Feb 7, 2024 by avibootz

Related questions

1 answer 93 views
1 answer 131 views
4 answers 283 views
6 answers 338 views
1 answer 194 views
1 answer 156 views
1 answer 99 views
...