python url 中文

just posted @ 2010年5月24日 23:40 in python with tags python URL 中文 , 7113 阅读

用urllib.request.urlopen(url) 打开有中文的网址的时候会报错


import urllib.parse
将中文 urllib.parse.quote("中文字符",encoding='GBK')

即 strurl='http://'localhost/test.php?parm='+urllib.parse.quote("我是中文",encoding='GBK')


注意:urllib.parse.quote 里面只能是中文 如果吧链接都放进去 转换以后还是不能访问


  • 无匹配
tubo 说:
2010年5月25日 02:22




fnaf world 说:
2018年12月29日 12:33

The topic you share is very good, I appreciate your sharing. Thank you!

professional cleanin 说:
2021年9月20日 18:14

Maids are specialists. Though they could be portrayed in different ways in motion pictures and about television, they expect ahead into your property, handle the particular cleaning, and also leave realizing they've pleased and stored you content. If you take the time to hire the proper professionals for your job, you may well be far happier with all the results as compared to you thought you will be. What steps in case you take before attracting a person to execute these tasks to suit your needs.

HP Board Matric Impo 说:
2022年8月24日 20:22

HPBOSE 12th New Question Paper 2023 Download, HPBOSE is popular knows as Himachal Pradesh Board Of School Education. HP Board Matric Important Question Paper 2023 It is one of the large board in India. Himachal Pradesh Board is going to conduct Class 12th annual examination for those candidates who have successfully registered for 12th boards exams in 2023.

登录 *

loading captcha image...
or Ctrl+Enter