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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -