Reputation: 13
import pyparsing as pp
print(pp.nestedExpr(opener="(", closer=")").parseString("(account={eq:T 1 No Lim})", parseAll=True)[0])
Above code gives me below output:
['account={eq:T', '1', 'No', 'Lim}']
But I want to escape white spaces from value part and want below output:
[u'account={eq:T 1 No Lim}']
Can anyone please suggest ?
Upvotes: 1
Views: 169
Reputation: 13
[u'account={eq:T1NoLim}']
is the output when i used "(account={eq:T1NoLim})"
in example string But when i used "(account={eq:T 1 No Lim})"
then getting below output
['account={eq:T', '1', 'No', 'Lim}']
Upvotes: 0
Reputation: 2505
Maybe you can make use of originalTextFor
.
For example:
import pyparsing as pp
print(pp.originalTextFor(pp.nestedExpr(opener="(", closer=")")).parseString("(account={eq:T 1 No Lim})", parseAll=True)[0])
Upvotes: 1