XML File -- dictionary edit/search
Francesco Guerrieri
f.guerrieri at gmail.com
Tue Aug 28 06:04:40 EDT 2007
On 8/28/07, Nagarajan <naga86 at gmail.com> wrote:
> A simple yaml file might just do the trick.
> Your yaml file shall look like the following:
>
> Word-def.yaml
> word1: word1's definition
> word2: word2's definition
> ..
> ..
> ..
> Use pyyaml to handle yaml files.
> --------
> import yaml
> worddefs = yaml.load( open( "word-def.yaml", "r" ).read() )
> print worddefs
> --------
I agree with the suggestion for yaml!
Since definitions are to be inputed by the users, it could be better
to use yaml.safe_load() to reduce the risks...
francesco
More information about the Python-list
mailing list