Slicing URL with Python

后端 未结 10 1113
予麋鹿
予麋鹿 2020-12-15 01:17

I am working with a huge list of URL\'s. Just a quick question I have trying to slice a part of the URL out, see below:

http://www.domainname.com/page?CONTEN         


        
10条回答
  •  囚心锁ツ
    2020-12-15 01:31

    I figured it out below is what I needed to do:

    url = "http://www.domainname.com/page?CONTENT_ITEM_ID=1234¶m2¶m3"
    url = url[: url.find("&")]
    print url
    'http://www.domainname.com/page?CONTENT_ITEM_ID=1234'
    

提交回复
热议问题