Dictionary checking

Mark McEahern marklists at mceahern.com
Sat May 25 16:38:50 EDT 2002


[Bjørn Ove Grøtan]
> I'm building a dictionary with values from a file.

What does the file look like?

> for each key, I have an ID, Name and Alias
> for some keys I have only ID and Name, some keys with
> ID and Alias, some keys with all 3 and a few keys
> with only a ID with no Name and no Alias.
>
> How can I check if Name and/or Alias contain anything.
> If Name contains any string it's ok, but if not I want to
> use the string value of Alias - and if not any value (space/blank)
> of Alias I want to do some error-handling.
>
> Also, I want to make some output with data combined from 2 dictionaries.
> Does anyone have any examples on how to do this?

It would be tremendously helpful if your post were a bit more explicit.

Cheers,

// mark

-






More information about the Python-list mailing list