I have
>>>i=65536
>>>print('The value of i is', i)
The value of i is 65536
How do I get the output (notice the lack of space between is
& 65536
)
The value of i is65536
Without manipulating the strings prior to the print()
I have
>>>i=65536
>>>print('The value of i is', i)
The value of i is 65536
How do I get the output (notice the lack of space between is
& 65536
)
The value of i is65536
Without manipulating the strings prior to the print()
There are two choices.
First, you can use the sep
keyword argument to the print
function:
print('The value of i is', i, sep='')
Or, better, you can use string formatting instead of a multi-argument print
call:
print('The value of i is{}'.format(i))
The second one is a lot more flexible, and more readable for any but the simplest cases. But either one works.
print('The value of i is{my_var}'.format(my_var=i))
or
print('The value of i is' + str(i))
Another way you could do it is:
i=65536
print('The value of i is', end='')
print(i)
When you do:
end=''
You are making it so it does not skip to the next like after finish that print statement.