<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Others may have gotten there first, but at least I added the completely gratuitous lambda!<br></span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> joshua kaderlan &lt;jkaderlan@yahoo.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Vikram K &lt;kpguy1975@gmail.com&gt;; "baypiggies@python.org" &lt;baypiggies@python.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Monday, May 2, 2011 3:51 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Baypiggies] python
 list manipulation using map<br></font><br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv1297963142"><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;"><div><span><br></span></div><div>That's actually a map() call inside a list comprehension. Either a bare map() call or a list comprehension without the map() call will do what you want. <br></div><div><br></div><div>E.g.,</div><div>&gt;&gt;&gt; T2 = map(lambda i: int(i), x)</div><div><br></div><div>or <br></div><div><br></div><div>&gt;&gt;&gt; T2 = [int(i) for i in x]</div><div><br></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:
 bold;">From:</span></b> Vikram K &lt;kpguy1975@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> baypiggies@python.org<br><b><span style="font-weight: bold;">Sent:</span></b> Monday, May 2, 2011 3:37 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [Baypiggies] python list manipulation using map<br></font><br>
<div id="yiv1297963142">i have a list whose elements are strings. all the elements in the list are numbers but are represented as string type and i wish to convert them to int type. i tried using map but the output is not what i want. please help.<br>
<br>&nbsp;x = ['0', '0', '20', '15', '42', '0', '0', '0', '0', '0', '0', '0', '0', '52', '57', '0', '254', '0', '177', '0', '617', '1021979']<br>
<br>&gt;&gt;&gt; T2 = [map(int, i) for i in x]<br>&gt;&gt;&gt; T2<br>[[0], [0], [2, 0], [1, 5], [4, 2], [0], [0], [0], [0], [0], [0], [0], [0], [5, 2], [5, 7], [0], [2, 5, 4], [0], [1, 7, 7], [0], [6, 1, 7], [1, 0, 2, 1, 9, 7, 9]]<br>
<br>----------<br><br>
</div><br>_______________________________________________<br>Baypiggies mailing list<br><a rel="nofollow" ymailto="mailto:Baypiggies@python.org" target="_blank" href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>To change your subscription options or unsubscribe:<br>http://mail.python.org/mailman/listinfo/baypiggies<br><br></div></div></blockquote></div></div></div><meta http-equiv="x-dns-prefetch-control" content="on"><br><br></div></div></blockquote></div></div></body></html>