Menu

#13 Flat ParseResults

v1.0 (example)
open
nobody
None
5
2016-02-17
2016-02-17
Dan Strohl
No

Is there a way of having the parseresults come out as a flat list instead of nested?

So, for example, if I have a string, say a complex email address that looks like this:

dan(a cool guy).strohl@(neato company)"my.dream.job".com,
what I would like back is something effectivly like:

results = email_address_parser.parseString('dan(a cool guy).strohl@(neato company)"my.dream.job".com,')

results['comments']
['a cool guy', 'neato company']

results['local part']
['dan.strohl']

results['domain part']
['"my.dream.job".com']

results['quoted_strings']
['my.dream.job']

So, all of the results names are at the same level.

As far as I can tell today, I have do do something like:

results['local part']['comment']
['a cool guy']

And I cant figure out how to get 'dan.strohl' out of results['local part'] without some additional post processing.

thoughts / ideas?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.