<div class="gmail_quote">On Sun, Mar 6, 2011 at 8:46 PM, nookasree ponamala <span dir="ltr"><<a href="mailto:nookasree@yahoo.com">nookasree@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit" valign="top"><div>Thanks for the reply Wayne, but still it is not working,</div>
<div> </div>
<div>when I used int It throws the below error:</div>
<div><div class="im"> File "<stdin>", line 2, in <module><br> File "<stdin>", line 3, in summary<br></div> File "<stdin>", line 3, in <genexpr><br>ValueError: invalid literal for int() with base 10: "'"</div>
<div> </div>
<div>I tried using float and the error is:</div>
<div><div class="im">Traceback (most recent call last):<br> File "<stdin>", line 2, in <module><br> File "<stdin>", line 3, in summary<br></div> File "<stdin>", line 3, in <genexpr><br>
ValueError: invalid literal for float(): '</div>
<div> </div>
<div>Thanks,</div>
<div>Sree.<br><br></div></td></tr></tbody></table></blockquote><div><br>
</div></div>I played with it a bit and simplified things a (little) bit:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"> b = (aline[3].strip('$'))<br>
t = (a, float(b))<br> tot.append(t)<br> print tot<br></blockquote><br>You were converting the tuple to a string before adding it to the list; you don't need to do that, and it was concealing the real cause of your problem, which is that you either need to skip/get rid of the top line of your file, or write some error-handling code to deal with it. Currently, you're trying to convert the string 'amt' into a number, and you just can't do that.<br>