[Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
Stephen J. Turnbull
stephen at xemacs.org
Sat Jan 11 20:49:47 CET 2014
More information about the Python-Dev mailing list
Sat Jan 11 20:49:47 CET 2014
- Previous message: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
- Next message: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
MRAB writes:
> > with open("outfile.pdf", "w", encoding="latin-1") as f:
> > f.write(pdf)
> >
> [snip]
> The second example won't work because you're forgetting about the
> handling of line endings in text mode.
Not so fast! Forgot, yes (me too!), but not work? Not quite:
with open("outfile.pdf", "w", encoding="latin-1", newline="") as f:
f.write(pdf)
should do the trick.
- Previous message: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
- Next message: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list