python how to get part of any specific url when using urlparse?
How to get specific part of any url using urlparse()? Question: I have an url like this url = ‘https://grabagun.com/firearms/handguns/semi-automatic-handguns/glock-19-gen-5-polished-nickel-9mm-4-02-inch-barrel-15-rounds-exclusive.html’ When I use urlparse() function, I am getting result like this: >>> 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’ Is it possible to get something like this: path1 = "firearms" path2 = "handguns" path3 = "semi-automatic-handguns" …