Proper form for printing a newline (python) -


if want print newline in python, better form use print(''), or print('\n', end = ''), or else?

print('\n', end = '') seems on complicated, while print('') feels bit strange.

using python3, if need print newline character, use:

print()

looking @ documentation print(), shows default end character '\n'.

print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=false)  prints values stream, or sys.stdout default. optional keyword arguments: file:  file-like object (stream); defaults current sys.stdout. sep:   string inserted between values, default space. end:   string appended after last value, default newline. flush: whether forcibly flush stream. type:      builtin_function_or_method 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -