How to create tuples from a single list with alpha-numeric chacters?
<p>I have the following list with 2 elements:</p>

<pre><code>['AGCTT 6 6 35 25 10', 'AGGGT 7 7 28 29 2']
</code></pre>

<p>I need to make a list or zip file such that each alphabet corresponds to its number further in the list. For example in list[0] the list/zip should read</p>

<pre><code>{"A":"6", "G":"6", "C":"35","T":"25","T":"10"}
</code></pre>

<p>Can I make a list of such lists/zips that stores the corresponding vales for list[0], list[1],...list[n]?</p>

<p>Note: The alphabets can only be A,G,C or T, and the numbers can take anyvalue</p>

<p>Edit 1: Previously, I thought I could use a dictionary. But several members pointed out that this cannot be done. So I just want to make a list or zip or anything else recommended to pair the Alphabet element to its corresponding number. </p>

<p>If you consider using tuples to pair the items, then this works:   </p>

<pre><code>&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; lst = ['AGCTT 6 6 35 25 10', 'AGGGT 7 7 28 29 2']
&gt;&gt;&gt; new_lst = [list(zip(sub[0], sub[1:])) for sub in [i.split() for i in lst]]
&gt;&gt;&gt; pprint(new_lst)
[[('A', '6'), ('G', '6'), ('C', '35'), ('T', '25'), ('T', '10')],
 [('A', '7'), ('G', '7'), ('G', '28'), ('G', '29'), ('T', '2')]]
</code></pre>

<ol>
<li><p><code>[i.split() for i in lst]</code>: An initial split on the string.</p></li>
<li><p><code>zip(sub[0], sub[1:]))</code>: Zip lists of alphabets and list of numbers</p></li>
</ol>

python list dictionary zip tuples