In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to use the python crawler quote () method, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Description
1. Quote () can convert the content to URL-encoded format.
2. When there are Chinese parameters in URL, it may sometimes lead to garbled codes. At this point, Chinese characters can be converted to URL encoding in this way.
Example
From urllib.parse import quote keyword = 'wallpaper' url = 'https://www.baidu.com/s?wd=' + quote (keyword) print (url)
A Chinese search text is declared and then URL encoded with the quote () method.
Result
Https://www.baidu.com/s?wd=%E5%A3%81%E7%BA%B81https://www.baidu.com/s?wd=%E5%A3%81%E7%BA%B810. Unquote ()
With the quote () method and, of course, the unquote () method, which can be decoded for URL, the example is as follows:
From urllib.parse import unquote url = 'https://www.baidu.com/s?wd=%E5%A3%81%E7%BA%B8'print(unquote(url))
The URL-encoded result obtained above is restored here using the unquote () method.
The above https://www.baidu.com/s?wd= wallpaper is all the contents of this article entitled "how to use the python crawler quote () method". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.