Source code
print("")❯ Try editing the highlighted part of the code above
Edit the "…" in the code above. "A" = 1 byte, "é" = 2 bytes, "あ" = 3 bytes, an emoji = 4 bytes ── the UTF-8 shape changes.
Memory / executionStep 1 / 6
👁 What you can see ── text appeared on the screen
Running print("café") shows café on the screen. That’s all the writer sees. But behind the scenes, this text is handed to the “window for the screen” (standard output), then passes through several stages (turn characters into bytes → hold them briefly → send them out) before reaching the screen. Steps ②–⑤ open up that process one layer at a time (the names of the functions called inside are under “🔬 Look closer” below).
What print calls inside (the call chain)Advanced
First, print’s own job is tiny. It picks the output target (standard output, sys.stdout, unless you say otherwise) and hands the text to it with write ── that’s about it. Numbers are turned into text with str() first, and a newline (end='\n') is passed at the end. Here, café is handed to sys.stdout.
1 / 2