Re: [Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

2014年1月10日 14:15:12 -0800

2014年1月10日 Juraj Sukop <[email protected]>:
> In the case of PDF, the embedding of an image into PDF looks like:
>
> 10 0 obj
> << /Type /XObject
> /Width 100
> /Height 100
> /Alternates 15 0 R
> /Length 2167
> >>
> stream
> ...binary image data...
> endstream
> endobj
What not building "10 0 obj ... stream" and "endstream endobj" in
Unicode and then encode to ASCII? Example:
data = b''.join((
 ("%d %d obj ... stream" % (10, 0)).encode('ascii'),
 binary_image_data,
 ("endstream endobj").encode('ascii'),
))
Victor
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to