On 15Apr2017 14:05, Alan Gauld wrote:
On 15/04/17 03:17, Palm Tree wrote:
s="2*3+3(8-4(5+6+9))+2+3+3(4/4)"
i want to find expression enclosed in brackets.
i want outputs to be like:
(8-4(5+6+9))
(5+6+9)
(4/4)
You probably could do it with some fancy regex but personally
I'd investigate a
> coming to recursion well i currently use eval() so everything ok i don't
> have to worry about brackets but i want to write my own parser. a top down
> parser for expressions.
Do *not* use eval to parse expressions. It is an extremely bad idea to do this.
Instead, you can use ast.parse, whic
-- Forwarded message --
From: "Palm Tree"
Date: 16 Apr 2017 10:07
Subject: Re: [Tutor] bracket issue
To: "Peter Otten" <__pete...@web.de>
Cc:
Ok thanks for the answers. Perfect.
Just to clarify why i wanted recursion was that well coming to compiler
Palm Tree wrote:
> hi all. i'm trying to write a simple program. i'm using python 3.4
>
> let us say i have
>
> s="2*3+3(8-4(5+6+9))+2+3+3(4/4)"
>
> i want to find expression enclosed in brackets.
>
> i want outputs to be like:
> (8-4(5+6+9))
> (5+6+9)
> (4/4)
> note : i'd like an answer invol
On 15/04/17 03:17, Palm Tree wrote:
> s="2*3+3(8-4(5+6+9))+2+3+3(4/4)"
>
> i want to find expression enclosed in brackets.
>
> i want outputs to be like:
> (8-4(5+6+9))
> (5+6+9)
> (4/4)
>
You probably could do it with some fancy regex but personally
I'd investigate a proper text parser. There
hi all. i'm trying to write a simple program. i'm using python 3.4
let us say i have
s="2*3+3(8-4(5+6+9))+2+3+3(4/4)"
i want to find expression enclosed in brackets.
i want outputs to be like:
(8-4(5+6+9))
(5+6+9)
(4/4)
i've tried where denotes an indentation level :
#first part
sbracket