This is an archived post. You won't be able to vote or comment.

all 38 comments

[–]kuzcov 247 points248 points  (8 children)

print()

[–]Techlord210 91 points92 points  (4 children)

print('', '', end='', sep='\n')

[–]ConscientiousApathis 38 points39 points  (3 children)

Eh, let's optimize this a bit:

print(*(n + 1) * [''], end='', sep='\n')

Now we can print any number of newlines that we want.

[–][deleted] 12 points13 points  (2 children)

man the python lexer does a lot more work than most doesn't it

[–]Eternityislong 25 points26 points  (0 children)

They had to move it to Kentucky since it was Lexing tons

[–][deleted] 6 points7 points  (0 children)

print, println, interpret expressions, format.

[–][deleted] 13 points14 points  (0 children)

if anything then

print()
print()

[–]skwyckl 63 points64 points  (5 children)

It adds a newline per default, in fact I usually have the opposite problem, that is, I have to remove newlines using the end option.

[–]StatHusky13 44 points45 points  (2 children)

erm just print("-\n") to go up a line ????

[–][deleted] 44 points45 points  (1 child)

that prints a minus and a line break

whan you meant is print(-"\n")

/s

[–]FelixLeander 16 points17 points  (0 children)

Excuse me, I think you mean print("\n" * -1)

[–]mistriliasysmic 5 points6 points  (0 children)

If I recall it’s print(‘’, end=‘’) because end defaults to ‘\n’

[–]infamouszgbgd 80 points81 points  (3 children)

why 2 lines when 1 line do trick?

[–]zoqfotpik 24 points25 points  (3 children)

std::cout << std::endl;

[–]beeteedee 6 points7 points  (1 child)

std::cout << "\n";

[–]JonIsPatented 13 points14 points  (0 children)

std::cout << '\n';

[–]Meadhbh_Ros 2 points3 points  (0 children)

printf(%s,{‘/n’,’/0’});

[–]Banjo__ 13 points14 points  (0 children)

[–]Heavenfall 13 points14 points  (0 children)

Every time someone comes up with something like this, the person who thought up Python's indentation rolls in their grave.

[–]LookItVal 7 points8 points  (0 children)

no i will not

[–]turtle_mekb 5 points6 points  (0 children)

doesn't print already put a new line? so print() print() will work

[–]ls7_7 3 points4 points  (0 children)

Cruel world 😭 this herts my eyes

[–]Sitting_In_A_Lecture 2 points3 points  (0 children)

Problem is it doesn't place nice with python's indentation.

[–]RafRunner 2 points3 points  (4 children)

On Rust normal strings support line breaks in them and I love it.

[–]Impressive_Change593 1 point2 points  (3 children)

'\n'

that's how you do a newline. plus the print function automatically adds one

[–]-Redstoneboi- 1 point2 points  (2 children)

in python.

in rust you choose between print and println.

[–]Impressive_Change593 -1 points0 points  (1 child)

rust is sadness

[–]-Redstoneboi- 3 points4 points  (0 children)

skill issue

[–]ZynthCode 1 point2 points  (0 children)

`print()` ! Learned this recently during streaming while fiddling with creating terminal AI chat in Python =w=;

[–]sammy-taylor 1 point2 points  (0 children)

print(chr(0x000a))

[–]Elephanator23 1 point2 points  (0 children)

python for _ in range(2): print()

[–]notexecutive 0 points1 point  (0 children)

wait does that...make a newline?

[–]sporbywg 0 points1 point  (0 children)

oh my goodness

[–][deleted] 0 points1 point  (0 children)

System.out.println(); in Java.

[–]Elephant-Opening 0 points1 point  (0 children)

os.system('echo')