[Tutor] Question on converting a list per say

Karthikesh Raju karthik at james.hut.fi
Mon Sep 6 12:06:30 CEST 2004


Hi All,

Is it possible to directly convert a list to int/float or complex etc

say a = ['1','2','3']

can i do an int(a) to get [1,2,3] or a float(a).

Presenly i do:
b = []
for vals in a
    b.append(int(a))


now my a's are quite big like something with 100000 elements? Isint it not
a slow process to do it like i do?

Warm regards

karthik

PS: Thankx for the regex question - it works with minor modifications

-----------------------------------------------------------------------
Karthikesh Raju,		    email: karthik at james.hut.fi
                                           karthikesh.raju at gmail.com
Researcher,			    http://www.cis.hut.fi/karthik
Helsinki University of Technology,  Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc.,    Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------


More information about the Tutor mailing list