I'm not exactly sure what these modules are used for. I get that they split the respective url into its components, but why would that be useful, or what is an example of when to use urlparse?
相关问题
- How to extract service state via Systemd DBus API?
- Elements' sizes don't update on applicatio
- Python CGI with flask not working
- Removing a selection from a listbox, as well as re
- Thrift python 3.4 TypeError: string argument expec
相关文章
- Getting errors / failing tests when installing Pyt
- Why does IDLE 3.4 take so long on this program?
- Unable to see or modify value of PYTHONHASHSEED th
- Python relative import with more than two dots
- How to print out a numbered list in Python 3
- Waiting for a task to complete after KeyboardInter
- Call dll function works in IronPython, doesn't
- Python3 no such file or directory
Use
urlparse
only if you need parameter. I have explained below why do you need parameter for.Reference
Hostname is always useful to store in variable to use it later or adding parameter, query to hostname to get the web page you want while scraping.
Regarding Parameter:
FYI: According to RFC2396, parameter in url
Parameter are useful in scraping, e.g. if the url is
http://www.example.com/products/women?color=green
When you use
urlparse
, you will get parameter. Now You have to change it tomen
so it will behttp://www.example.com/products/men?color=green
andkids
,girl
,boy
so on.