Conversion of string to integer
Thinker
thinker at branda.to
Tue Jan 30 03:39:30 EST 2007
More information about the Python-list mailing list
Tue Jan 30 03:39:30 EST 2007
- Previous message (by thread): Python 2.5 Tkinter not configured
- Next message (by thread): Conversion of string to integer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jupiter wrote: > 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"] > hs = [.............] import re reo = re.compile(r'^[0-9]+(\.[0-9]+)?$') result = [e for e in hs if reo.match(e)] -- Thinker Li - thinker at branda.to thinker.li at gmail.com http://heaven.branda.to/~thinker/GinGin_CGI.py
- Previous message (by thread): Python 2.5 Tkinter not configured
- Next message (by thread): Conversion of string to integer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list