How to convert a list of strings into a list of integers
<p>In the below part of code <strong>v</strong>   is a list of characters. </p>

<pre><code>import collections
import csv
import sys


with open("prom output.csv","r") as f:
    cr = csv.reader(f,delimiter=",")
    d=collections.defaultdict(lambda : list())
    header=next(cr)    

    for r in cr:
        d[r[0]].append(r[1])   


with open("sorted output.csv","w") as f:
    cr = csv.writer(f,sys.stdout, lineterminator='\n')
    od = collections.OrderedDict(sorted(d.items()))

    for k,v in od.items():  
        cr.writerow(v)  
</code></pre>

<p>My output looks like    </p>

<p><a href="http://i.stack.imgur.com/tbveK.png" rel="nofollow"><img src="http://i.stack.imgur.com/tbveK.png" alt="enter image description here"></a></p>

<p>I want to map all the characters of my input into an integer, so that instead of a table with characters i get a table with numbers. I tried to use the built in function <strong>ord()</strong> but it doesnt work, since it only accepts single characters as input and not lists. Can you help?</p>

<p>You can use <a href="https://docs.python.org/3/library/functions.html#map" rel="nofollow"><code>map()</code></a> to apply an operation to each item in a list:</p>

<pre><code>a = ['a', 'b', 'c']
b = map(lambda c: ord(c), a)

print b
&gt;&gt;&gt; [97, 98, 99]
</code></pre>

python excel