why does python print function print a mark at the end of a line when i use the end parameter?

It does not come from Python, it comes from your shell, with two possibilities:

  • % is literally your shell prompt, since you don’t have a final linefeed it’s tacked onto the final line of your output
  • or if you’re using fish or zsh, they add a % before inserting their own linefeed, so that the prompt is at the right place but you’re still notified that the binary is behaving strangely


~ $ echo -n "hello shell"
hello world~ $ |

note that the shell prompt is tacked at the end of the output, rather than be a the familiar column 0

zsh / fish

~ $ echo -n "hello shell"
hello zsh% 
~ $ |

Prompt is at its normal position, and the shell has told you that the utility behaved oddly (because no final linefeed).

(nb: on my system using zsh, the % being automatically inserted is also in inverted colors to be even more noticeable).

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top