Re: How to calculate a file of equations in python

2007-03-21 Thread Boris Borcic
r='' for line in file : r = str(eval(r+line)) John wrote: > Hi, > I have a text file which contains math expression, like this > 134 > +234 > +234 > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > Can you please tell me what is the easiest way to calculate that file? >

Re: How to calculate a file of equations in python

2007-03-19 Thread Paul Rubin
"John" <[EMAIL PROTECTED]> writes: > I have a text file which contains math expression, like this > 134 > +234 > +234 Erm, is this a homework assignment? Basicaly you need to identify all the separate operands and operators and decide what to do with them. I'm guessing you don't have to worry abo

Re: How to calculate a file of equations in python

2007-03-19 Thread Michele Simionato
On Mar 20, 1:03 am, Michael Bentley <[EMAIL PROTECTED]> wrote: > On Mar 19, 2007, at 11:48 PM, John wrote: > > > Hi, > > I have a text file which contains math expression, like this > > 134 > > +234 > > +234 > > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > > Can you pl

Re: How to calculate a file of equations in python

2007-03-19 Thread Michael Bentley
On Mar 19, 2007, at 11:48 PM, John wrote: > Hi, > I have a text file which contains math expression, like this > 134 > +234 > +234 > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > Can you please tell me what is the easiest way to calculate that file? > for example the

How to calculate a file of equations in python

2007-03-19 Thread John
Hi, I have a text file which contains math expression, like this 134 +234 +234 (i.e. an operation (e.g. '+) and then a number and then a new line). Can you please tell me what is the easiest way to calculate that file? for example the above example should be = 134 + 234 + 234 = 602. Thank you.