I can not use end within the print function. I'm using version 2.7 of python.
Example:
for i in range(10):
print("el numero es " + str(i), end=" ")
I need you not to make the line break and print it on the same line
I can not use end within the print function. I'm using version 2.7 of python.
Example:
for i in range(10):
print("el numero es " + str(i), end=" ")
I need you not to make the line break and print it on the same line
There are many ways to accomplish what you are looking for. The easiest way is the following
>>> import sys
>>> for i in xrange(10):
... sys.stdout.write("El numero es:" + str(i))
... iiiiiiiiii
Another way is using a backspace with "\ b"
>>> for i in xrange(10):
>>> print '\bi'
... iiiiiiiiii
If you have English skills at this question you can find and try several ways.
You let me know if you have any questions or problems.
Another possibility is to bring the print
from the future (although it is already present for a long time):
from __future__ import print_function
for i in range(10):
print("el numero es " + str(i), end=" ")