Thanks for your reply. Another point to note: if you get a personal
reply (often you will just see replies on the list, but sometimes people
will also mail you directly) it is usual to make sure the list gets
copied in any reply.
I hope you don't mind that I am sending a copy of this message t
dict also has 'get' which provides a default if the key isn't defined:
a={}
print a.get('a','default')
default
-Rick King
southfield MI
--
http://mail.python.org/mailman/listinfo/python-list
bvidinli wrote:
i use dictionaries to hold some config data, such as:
conf={'key1':'value1','key2':'value2'} and so on...
when i try to process conf, i have to code every time like: if
conf.has_key('key1'): if conf['key1']<>'': other commands
this is very annoying. in php, i was able to c
bvidinli wrote:
I posted to so many lists because,
this issue is related to all lists,
No, it isn't, as you would have discovered had you bothered to read the
purpose of each list. For example, python-help and python-dev are
mutually exclusive.
this is an idea for python,
It isn't an id
On Thu, 24 Apr 2008 10:24:37 +0200
Robert Bossy <[EMAIL PROTECTED]> wrote:
> Way 2: make conf a defaultdict instead of a dict, the documentation is
> there:
> http://docs.python.org/lib/defaultdict-objects.html
Only for 2.5 and up though.
--
D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democ
bvidinli <[EMAIL PROTECTED]> writes:
> i use dictionaries to hold some config data,
> such as:
>
> conf={'key1':'value1','key2':'value2'}
> and so on...
>
> when i try to process conf, i have to code every time like:
> if conf.has_key('key1'):
> if conf['key1']<>'':
> other commands.
bvidinli wrote:
i use dictionaries to hold some config data,
such as:
conf={'key1':'value1','key2':'value2'}
and so on...
when i try to process conf, i have to code every time like:
if conf.has_key('key1'):
if conf['key1']<>'':
other commands
this is very annoying.
in php, i