Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the urlsplit () method of python crawler

Shulou Source: shulou.com Published: 2022-06-03 17:39:04 11月14日 Update

This article mainly introduces how to use the urlsplit () method of python crawler. It is very detailed and has certain reference value. Friends who are interested must finish it!

1. Very similar to the urlparse () method, but it no longer parses the params part separately and returns only five results.

From urllib.parse import urlsplit result = urlsplit ('http://www.baidu.com/index.html;user?id=5#comment')print(result)

The results are as follows:

SplitResult (scheme='http', netloc='www.baidu.com', path='/index.html;user', query='id=5', fragment='comment')

As you can see, the returned result is SplitResult.

2. In fact, it is also a tuple type, which can be obtained either by attribute or index.

From urllib.parse import urlsplit result = urlsplit ('http://www.baidu.com/index.html;user?id=5#comment')print(result.scheme, result [0]) these are all the contents of the article "how to use the python crawler urlsplit () method". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Methods results crawlers content articles similarity value interest reality actually guys buddies attributes more knowledge types indexes industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB Redmi MySQL OPPO Reno