solved, sorry for the disturb

http://stackoverflow.com/questions/23344345/strings-not-converting-to-float-as-expected/23344830#23344830

bye

Gabriele


2014-04-28 11:13 GMT-04:00 Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com>:

> Hi,
>
> I'm trying to convert a string to a float. It seems a basic thing but I
> don't know why I'm getting this erroris
>
> Traceback (most recent call last):
>   File "phresREADER.py", line 27, in <module>
>     tra = float(stri)
> ValueError: could not convert string to float:
>
> My file has this line
>
> 5.50000e+000 5.50000e+001 5.50000e+002 5.50000e+003
>
> my code is:
>
> my_line = f.readline()
> avg_energySTR = [str(i) for i in my_line.split(' ')]
> for stri in avg_energySTR:
>         tra = float(stri)
>
> do you have any idea?
>
> thanks
>
> Gabriele
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to