Wouldn't you like to use Python 3? In Python 3 print
is a function that accepts optional keyword arguments that modify its behaviour according to your desires
In [1]: help(print)
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
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.
flush: whether to forcibly flush the stream.
How does this apply to your problem (or, to be honest, to your particular approach to your task that becomes your problem, as per the comment by Padraic)? You have two possibilities
In [2]: print('The result is ', 8775, '.', sep='')
The result is 8775.
In [3]: print('The result is ', end=''); print(8755, end=''); print('.')
The result is 8775.
In [4]:
If you are stuck in Python 2 you can still take advantage of print
as a function importing this behaviour from the __future__
, using
from __future__ import print_function
in your programs.
If you don't know very much about this import from __future__
stuff, SO is your friend...,