0

I am trying to run a loop and I want to use print() on 1 line only but here it needs long spacing so that the letters are not overwritten from the previous print result, and for that I really need long spacing, but I see it is not neat in my code.

Is there a way to replace long spaces in print()?

print('[%s!%s] Failed Scraping                                            '%(M, N), end='\r');
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 14 '23 at 16:58

1 Answers1

0

by using the str.format() method or f-strings (formatted string literals).

M = "A"
N = "B"
message = "[{}!{}] Failed Scraping".format(M, N)
print(message.ljust(70), end='\r')