print on one line python code example

Example 1: print no new line python

print('*', end='')
print('*', end='')
print('*', end='')

# output:
# ***

Example 2: print progress without next line python

print i/len(some_list)*100," percent complete         \r",

Example 3: print progress without next line python

def f():
     print('xy', end='')
     print('\rzz')
 
f()

>> zz // \r make cursor reset to the start of the line and over-write any text after that

Example 4: python print without new lines

print('Foo', end='')

Example 5: python print in one line

print(item, end=" ")