How to make a list of lists in Python?
<p>Assume,</p>

<pre><code>range(len(column)) = 4
column = ['AAA', 'CTC', 'GTC', 'TTC']
for i in range(len(column)):
    a = list(column[i])
</code></pre>

<p>Outside of this loop I want a variable,say x to be assigned such that it gives the following output. </p>

<pre><code> ['A', 'A', 'A']
 ['C', 'T', 'C']
 ['G', 'T', 'C']
 ['T', 'T', 'C']
</code></pre>

<hr>

<p>After doing this, here is what I should be able to do:
In the Next, I want to compare within x. Say x[2] to tell me if 'G' is different from 'T' and if 'G' is different from 'C' and if 'T' is different from 'C'</p>

<p>I believe you are in need of a list of lists</p>

<p>Code:</p>

<pre><code>column = ['AAA', 'CTC', 'GTC', 'TTC']
x=[]
for i in range(len(column)):
    a = list(column[i])
    x.append(a)

print x
</code></pre>

<p>Output:</p>

<pre><code>[['A', 'A', 'A'], ['C', 'T', 'C'], ['G', 'T', 'C'], ['T', 'T', 'C']]
</code></pre>

python python-2.7 for-loop return