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 127 views
1 answer 166 views
4 answers 322 views
6 answers 465 views
1 answer 224 views
1 answer 202 views
1 answer 139 views
...