From help(print) :
Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline.
You can use the end keyword:
>>> for i in range(1, 11): ... print(i, end='') ... 12345678910>>>
Note that you will have to print() do the last new line yourself. BTW, you will not get "12345678910" in Python 2 with a trailing comma, instead you will get 1 2 3 4 5 6 7 8 9 10 .
DSM Aug 20 2018-12-12T00: 00Z
source share