Python: for loop – print on the same line [duplicate]

Use end parameter in the print function

print(new_item, end=" ")

There is another way to do this, using comprehension and join.

print (" ".join([function(word) for word in split]))

Leave a Comment