[GRASS-dev] pygrass - stdout2dict

Martin Landa landa.martin at gmail.com
Tue Apr 7 04:05:52 PDT 2015


2015-04-07 12:58 GMT+02:00 Pietro <peter.zamb at gmail.com>:
> You are right the function has not been defined... probably I can
> simply update the docstring adding the function, something like:
>
> {{{
> def stdout2dict(stdout):
>     return dict([kv.split('=') for kv in stdout.strip().split('\n')])
> }}}
>
> or with lambda
>
> {{{
> stdout2dict = lambda x: dict([i.split('=') for i in x.strip().split('\n')])
> }}}

hm, is there any way how to parse command output using pygrass without
need to define your own function?

Thanks, Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


More information about the grass-dev mailing list