When I tried

total = 0
with open('/Users/richarddillon/Desktop/numbers.txt', 'r') as infile:
   for line in infile:
       total += float(line)
print(total)

Python returned         "ValueError: could not convert string to float: "

Richard

On Aug 30, 2014, at 1:13 PM, Alan Gauld <alan.ga...@btinternet.com> wrote:

> total = 0
> with open('/Users/richarddillon/Desktop/numbers.txt', 'r') as infile:
>    for line in infile:
>        total += float(line)
> print(total)

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to