4
A brief example:
zero = 0
print('exemplo',zero)
The program shows:
example 0
I wish without the space:
exemplo0
4
A brief example:
zero = 0
print('exemplo',zero)
The program shows:
example 0
I wish without the space:
exemplo0
10
In that exact way, print('exemplo',zero)
, nay.
But the way (only available in python3.x) more like this, in which space is taken out is:
zero = 0
print('exemplo', zero, sep='') # exemplo0
Here are other ways for that to happen:
zero = 0
print('exemplo{}'.format(zero))
Sign of +
print('exemplo' +str(zero)) # aqui, se ja for string escusas de usar str(...)
print('exemplo%d' % zero)
You can also create your own print()
for things like this:
def my_print(*args):
print(*args, sep='')
zero = 0
my_print('example', zero, 1, 2, 'olá') # example012olá
Browser other questions tagged python-3.x
You are not signed in. Login or sign up in order to post.