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 205 views
1 answer 262 views
4 answers 513 views
6 answers 763 views
1 answer 325 views
1 answer 317 views
1 answer 246 views
...