我有一个这样的网址
url = 'https://grabagun.com/firearms/handguns/semi-automatic-handguns/glock-19-gen-5-polished-nickel-9mm-4-02-inch-barrel-15-rounds-exclusive.html'
当我使用
urlparse()
函数,我得到的结果如下:
>>> url = urlparse(url)
>>> url.path
'/firearms/handguns/semi-automatic-handguns/glock-19-gen-5-polished-nickel-9mm-4-02-inch-barrel-15-rounds-exclusive.html'
有可能得到这样的东西吗:
path1=“火器”
path2=“手枪”
path3=“半自动手枪”
我不想得到任何末尾有“.html”的文本。