Name
write_byte
Synopsis
m.write_byte(byte)
Writes byte,
which must be a single-character string, into mapping
m at the current position of
m’s file pointer,
overwriting the byte that was there, and then advances
m’s file pointer by
1. When x is a
single-character string,
m
.write_byte(
x
)
is similar to
m
.write(
x
).
However, if m’s file
pointer is at the end of m,
m
.write_byte(
x
)
silently does nothing, while
m
.write(
x
)
raises a ValueError exception. Note that this is
the reverse of the relationship between read and
read_byte at end-of-file: write
and read_byte raise ValueError,
while read and write_byte
don’t.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access