Python Forum

Full Version: Print in single line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This print in multiple lines

for i in range(1,9):
   print(i)
This print in single line concatenated
for i in range(1,9):
   print(i),
I need print in single line replacing the previous output. to use a single line when i'm output a list of value to be comparated,
for example when iterating in file name list of my disc in search of specific one

Some idea?
for i in range(1,9):
   print('{}'.format(i), end='')
print()