How do I get rid of the last message on Python?

Asked 1 years ago, Updated 1 years ago, 65 views

How do I get rid of the last message on Python? Let me know something easy

python newline

2022-09-22 22:36

1 Answers

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()


2022-09-22 22:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.