<p>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:</p>

<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234&amp;param2&amp;param3
</code></pre>

<p>How could I slice out:</p>

<pre><code>http://www.domainname.com/page?CONTENT_ITEM_ID=1234
</code></pre>

<p>Sometimes there is more than two parameters after the CONTENT_ITEM_ID and the ID is different each time, I am thinking it can be done by finding the first &amp; and then slicing off the chars before that &amp;, not quite sure how to do this tho.</p>

<p>Cheers</p>

I figured it out below is what I needed to do:
```
```
url = "http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3"
url = url[: url.find("&")]
print url
'http://www.domainname.com/page?CONTENT_ITEM_ID=1234'
```
```