Write the rstrip function.
The method of writing is as follows.
'hello python world\n\n\n'.rstrip()
However, Python's rstrip erases all kinds of spaces, not just the opening letters
If you just want to erase the opening text,
'hello python world\n\n\n'.rstrip('\n')
Please write it as.
There is also lstrip that clears the left space.
'\t\t\t hello python world\n\n\n'.rstrip().lstrip()
© 2024 OneMinuteCode. All rights reserved.