[python] remove a newline \n

  • 0

>>> 'test string \n'.rstrip('\n')
'test string '


>>> s = " \n  abc   def   "
>>> s.strip()
'abc   def'
>>> s.rstrip()
' \n  abc   def'
>>> s.lstrip()
'abc   def   '
>>>

沒有留言 :

張貼留言