read lines

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Tue Dec 4 08:50:06 EST 2007


Bruno Desthuilliers a écrit :
(snip)
> # Notice that here, b is a string, not a number...
>           try:
>               b = int(tmp[1])

oops, I meant:
                 b = float(tmp[1])


Idem here:

> def extract_number(iterable):
>   for linenum, line in enumerate(iterable):
>     try:
>       yield int(line.strip().split()[1])
         yield float(line.strip().split()[1])




More information about the Python-list mailing list