I would like to know how I can make a print in a for loop without the line breaks. In python Thank you very much
I would like to know how I can make a print in a for loop without the line breaks. In python Thank you very much
The answer depends on the version of python you are using. If you are using python2 you have to put a comma at the end of the impression:
print "tu mensaje",
Instead, in python3 you would have to set the default parameter "end" to an empty string or a space:
print("tu mensaje", end='')
If you are using Python 3.x, it will be as simple as modifying the 'end' parameter, which by default is a line break '\ n'
print("Mi mensaje", end='\n') # Imprime un salto de linea al final
It can be modified so that the line ends as one wishes. For example:
print("Mi mensaje", end='') # No imprime nada al final
print("Mi mensaje", end='\t') # Imprime una tabulacion al final
There you can continue traveling a little more.
Greetings!