如果您实际上想要在Python 3中进行GBK编码:
import json a = {"text": u"??"} print(json.dumps(a, ensure_ascii=False).encode('gbk'))
b'{"text": "\xc4\xe3\xba\xc3"}'