Python

Asked 2 years ago, Updated 2 years ago, 15 views

I also want to arrange the row with \n to the right, but when I used rjust, only the first line was aligned. How can't the columns that go down also align to the right?

python

2022-09-22 12:31

1 Answers

Why don't you split it into \n and use it?

str = "When you change the line\n, this is how you display\n";
for line in str.split("\n"):
    print(line.rjust(50))


2022-09-22 12:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.