Conversion of string to integer

jupiter anil.jupiter9 at gmail.com
Mon Jan 29 08:55:33 EST 2007


Hi guys,

I have a problem. I have a list which contains strings and numeric. 
What I want is to compare them in loop, ignore string and create 
another list of numeric values.

I tried int() and decimal() but without success.

eq of problem is

#hs=string.split(hs)
hs =["popopopopop","254.25","pojdjdkjdhhjdccc","25452.25"]

j=0
    for o in range(len(hs)):
        print hs[o],o
        p=Decimal(hs[o])
        if p > 200: j+=j
        print "-"*5,j
    print "*"*25

I could be the best way to solve this ......?


@nil




More information about the Python-list mailing list