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 92 views
1 answer 130 views
4 answers 283 views
6 answers 337 views
1 answer 193 views
1 answer 155 views
1 answer 98 views
...