Separating/accessing a triple tuple list like [[[x,y],z],p]?
<p>I am trying to access variables stored in a triple tuple list in python and I am not sure how to do it. I would like to be able to go through the list in a for loop and get x,y,x, &amp; p from each tuple. How would I do that? </p>

<pre><code>MovesList = [  [[[1,2],3],1] , [[[2,5],3],1] , [[[1,3],0],2]  ]
</code></pre>

<p>You can unpack tuples as you iterate over them:</p>

<p>Python 2:</p>

<pre><code>&gt;&gt;&gt; for ((x,y),z),p in MovesList:
...     print x, y, z, p
</code></pre>

<p>Python 3:</p>

<pre><code>&gt;&gt;&gt; for ((x,y),z),p in MovesList:
...     print(x,y,z,p)
</code></pre>

<p>Both of which result in:</p>

<pre><code>1 2 3 1
2 5 3 1
1 3 0 2
</code></pre>

python