Help with code = Extract numerical value to variable

rurpy at yahoo.com rurpy at yahoo.com
Thu Oct 22 20:53:22 CEST 2009


On Oct 22, 11:27 am, Steve <zerocostprod... at gmail.com> wrote:
> I have some data that I'm performing some analysis on.
> How do I grab the numerical value if it's present and ignore
> otherwise. So in the following example
> I would have assign the following values to my var
> 16
> 20
> 2
> 7
> 0
>
> In Field6
> Sample String data is
> sold: 16
> sold: 20
> sold: 2
> sold: 0
> sold: <storefront>
> 7
> 0
> <storefront>
> sold
> null

So you want a list of any number that
occurs in the file, if it occurs at the
start of the line, or is preceded by a
space character?  And you don't want
any duplicates in the list?  Is the order
of the results important?  That is, would
a result of 16,20,2,0,7 be acceptable?
Or how about 20,2,16,7,0?




More information about the Python-list mailing list