|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
url = "https://cbsprodcenter.noahwm.com/productcenter/pcIndex.jsp"
rget = requests.get( url , params = query_string_parameters )
txt = rget.text
with open("d:\\html_code.txt","w") as f:
f.write( str(txt) )
print(txt)
输出结果:UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 7793: illegal multibyte sequence
url = "https://cbsprodcenter.noahwm.com/productcenter/pcIndex.jsp"
rget = requests.get( url , params = query_string_parameters )
txt = rget.text.encode('utf-8')
with open("d:\\html_code.txt","w") as f:
f.write( str(txt) )
print(txt)
import requests
url = "https://cbsprodcenter.noahwm.com/productcenter/pcIndex.jsp"
rget = requests.get( url)
txt = rget.content#这里用字节集
with open("d:\\html_code.txt","wb") as f:
f.write(txt)
#print(txt)
|
-
输出结果
|