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.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.