我发现在Kotlin中有一个ByteArray.toString(charset:Charset)函数,当我在android studio IDE中使用该函数时,它会出现语法错误.但我在Kotlin org网站上尝试过相同的代码,效果很好.如何在Kotlin中将ByteArray转换为String?
我使用 python requests 发送请求,然后打印响应,令我困惑的是响应中的中文字符类似于\u6570\u636e\u8fd4\u56de\u6210\u529f
这是代码:
# -*- coding:utf-8 -*-
import requests
url = "http://www.biyou888.com/api/getdataapi.php?ac=3005&sess_token=&urlid=-1"
res = requests.get(url)
if res.status_code == 200:
print res.text
Run Code Online (Sandbox Code Playgroud)
以下是回复
我应该怎么做才能转移响应?我尝试过使用编码和解码,但它确实有效。