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?
>
"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
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
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
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.