+ 1

What the \n for? I just want a break line, how come it show \n

23rd Aug 2017, 8:56 PM
5p4c353c
5p4c353c - avatar
5 Respostas
0
in python \n is for next line \t is for tab. If you want to break a long statement in a function just use '\' for example: def print_something(): print(' This is a really long line', \ 'but we can make it across multiple lines using' , \ 'the backslash') another example: x = 10 if x == 10 or x > 0 or \ x < 100: print (True)
23rd Aug 2017, 9:04 PM
Infant Raj
Infant Raj - avatar
0
I mean when I use ``` it show \n on my line break
23rd Aug 2017, 9:08 PM
5p4c353c
5p4c353c - avatar
0
is it Python 2 and Python 3s different
23rd Aug 2017, 9:10 PM
5p4c353c
5p4c353c - avatar
0
Yes the syntax is a bit differnt for example in Python2 print 'hello' and in Pyhon3 its print('hello')
23rd Aug 2017, 9:23 PM
Infant Raj
Infant Raj - avatar
0
Ok I see, thx a lots!
24th Aug 2017, 1:56 AM
5p4c353c
5p4c353c - avatar