15

Is there a way that you can print more than one blank line in a programme, without having to type

print("\n")

load of times?

For example, I want to have a blank page (about 40 lines, I think) before my next line of text

brisbass
  • 199
  • 1
  • 2
  • 8
  • @jonrsharpe Don't think this is a duplicate. The answers in particular -- the accepted one here, and several there -- are especially good and distinct. – Bob Stein Apr 01 '15 at 17:19
  • @BobStein-VisiBone I'm not sure I understand your point - you seem to be saying that the answers there are good. If you think the answer below should also be on the duplicate, either comment on the answer or just add it yourself (it's already there as a comment, by the looks of things). If you can clarify why you think this isn't a duplicate, by all means vote to reopen, but I am unconvinced as yet. – jonrsharpe Apr 01 '15 at 17:23
  • Thanks @jonsharpe. No I think the answer below belongs here. It doesn't belong there. The reason this question is not a duplicate: arriving googlers may very well want to generate lots of blank lines for reasons other than clearing an entire screen, so they would be served here, and not there. The answer below is an especially tidy trick for doing that. And it's especially klunky for clearing a screen. (Point of order, I don't believe I have the rep to vote to reopen. Or am I not seeing the gizmo to click for that?) – Bob Stein Apr 01 '15 at 17:28

2 Answers2

29

Just use multiplication, this will repeat your string however many times you'd like, in this case new lines

>>> print('\n' * 40)
Cory Kramer
  • 114,268
  • 16
  • 167
  • 218
0

You want to print one black line in program use simple code here some example :

print('\n') print("welcome to python")

output:

welcome to python

nisha R
  • 1
  • 1
  • 2
    The question was more about the _repetition_, not the _how_. How does your answer scale to 40 blank lines? – OK. May 07 '20 at 14:29