Crawler basics-urlencode

1. What is urlencode?

Urlencode is a module that can encode strings in the form of URLs (in crawlers, this string is usually the header information as a request parameter, and this parameter can be found directly in the link)

from urllib.parse import urlencode

from urllib.parse import urlencode

data  = {
    
    
    'name' : 'Lantern Festival',
    'time' : '2021.2.26',
    }
print(urlencode(data))

Output result:
name=Lantern+Festival&time=2021.2.26
Observe the above output, the space in the name becomes a plus sign, and the two parameters will be linked with &

Guess you like

Origin blog.csdn.net/weixin_47249161/article/details/114137023