Splitting up a list into a 2D list using tabs and spaces
<p>I am trying to split up a python list into a 2D list starting with the following</p>

<pre><code>testList = ["Color BlueÂ»Temperature WarmÂ»Gender Male",
            "Color GreenÂ»Temperature WarmÂ»Gender Female"]
</code></pre>

<p>Where Â» is a tab character and the attributes (color, temp, gender) have a tab before them and the specifics (blue, warm, male) have a space before them.</p>

<p>I would like to ignored the attributes and create a 2D list like</p>

<pre><code>newList = [["Blue", "Warm", "Male"], ["Green", "Warm", "Female"]]
</code></pre>

<p>but I cannot figure out how to do this using the <code>split()</code> or <code>strip()</code> string methods.</p>

<p>If the attribute names and values are always single-worded, you can get every odd (indexing starts from 0) word in the string:</p>

<pre><code>&gt;&gt;&gt; testList = ["Color Blue Temperature Warm    Gender Male", "Color Green  Temperature Warm    Gender Female"]
&gt;&gt;&gt; print([item.split()[1::2] for item in testList])
[['Blue', 'Warm', 'Male'], ['Green', 'Warm', 'Female']]
</code></pre>

python list split strip