Skip to content

Commit b05586e

Browse files
committed
Add end='' explanation comment to all Python examples
1 parent da40ef9 commit b05586e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/sandbox/pty.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ sandbox = Sandbox()
127127
terminal = sandbox.pty.create(
128128
cols=80,
129129
rows=24,
130-
on_data=lambda data: print(data.decode(), end=''),
130+
on_data=lambda data: print(data.decode(), end=''), # end='' prevents extra newline
131131
)
132132

133133
# Send a command as bytes (b'...' is Python's byte string syntax)
@@ -167,7 +167,7 @@ sandbox = Sandbox()
167167
terminal = sandbox.pty.create(
168168
cols=80,
169169
rows=24,
170-
on_data=lambda data: print(data.decode(), end=''),
170+
on_data=lambda data: print(data.decode(), end=''), # end='' prevents extra newline
171171
)
172172

173173
# Resize to new dimensions (in characters)
@@ -283,7 +283,7 @@ sandbox = Sandbox()
283283
terminal = sandbox.pty.create(
284284
cols=80,
285285
rows=24,
286-
on_data=lambda data: print(data.decode(), end=''),
286+
on_data=lambda data: print(data.decode(), end=''), # end='' prevents extra newline
287287
)
288288

289289
# Kill the PTY
@@ -327,7 +327,7 @@ sandbox = Sandbox()
327327
terminal = sandbox.pty.create(
328328
cols=80,
329329
rows=24,
330-
on_data=lambda data: print(data.decode(), end=''),
330+
on_data=lambda data: print(data.decode(), end=''), # end='' prevents extra newline
331331
)
332332

333333
# Send exit command

0 commit comments

Comments
 (0)