How to base64 encode a PDF file in Python

前端 未结 4 1033
天命终不由人
天命终不由人 2021-02-04 14:17

How should I base64 encode a PDF file for transport over XML-RPC in Python?

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 14:37

    Looks like you might be able to use the binascii module

    binascii.b2a_base64(data)

    Convert binary data to a line of ASCII characters in base64 coding. The return value is the converted line, including a newline char. The length of data should be at most 57 to adhere to the base64 standard.

提交回复
热议问题