2024-09-30 04:38:08 发布
网友
我的URL为字符串:
urlString = https://play.com/details?id=blamore
如何从给定的字符串中获取id参数?在
id
在python3中正确的方法是使用^{}模块。在
from urllib.parse import urlparse, parse_qs url = 'https://play.com/details?id=blamore' t = urlparse(url) print(t) d = parse_qs(t.query) print(d)
输出
ParseResult的字段名应该是不言自明的,但是请参考the docs以获取详细信息。在
ParseResult
从^{} docs
Parse a query string given as a string argument (data of type application/x-www-form-urlencoded). Data are returned as a dictionary. The dictionary keys are the unique query variable names and the values are lists of values for each name.
在python3中正确的方法是使用^{} 模块。在
输出
^{pr2}$ParseResult
的字段名应该是不言自明的,但是请参考the docs以获取详细信息。在从^{} docs
相关问题 更多 >
编程相关推荐