split cell to rows by pipe python
<p>I am trying to split a cell into 2 rows by pipe ("|").</p>

<p>For instance:</p>

<pre><code>ID  Site    Category    Queries

1   0        38037      antique+wall+telephone|antique+wall+phone
</code></pre>

<p>will become:</p>

<pre><code>ID  Site    Category    Queries

1   0         38037     antique+wall+telephone

1   0         38037     antique+wall+phone
</code></pre>

<p>You can use .split()</p>

<pre><code>input = "antique+wall+telephone|antique+wall+phone"
output = input.split('|')
</code></pre>

<p>output will be a list of elements either side of the '|'</p>

<p>so output would be</p>

<pre><code>("antique+wall+telephone", "antique+wall+phone")
</code></pre>

<p>and then you can simply add the ID Number in front of each element of the list of strings</p>

<p>Hope that answers your question</p>

python