ys in a dict
>
>
> "Emilio Casbas" wrote
>
> > If I enter a not existent key, an exception is raised.
> > How can I control the not existent key and assign him a default value?
>
> One way is to use the get() method of a dictionary:
>
> >>> d = {'
Hello,
I have some problems testing keys not existent in a dictionary.
The code works testing existent keys with his corresponding value, but
If I enter a not existent key, an exception is raised.
How can I control the not existent key and assign him a default value?
u...@cipher:~/project/progra
Thanks to all for the responses.
I've filled a bug report as you pointed out.
http://bugs.python.org/msg86803
Thanks
Emilio
- Mensaje original
> De: Kent Johnson
> Para: Emile van Sebille
> CC: tutor@python.org
> Enviado: miƩrcoles, 29 de abril, 2009 13:06:49
> Asunto: Re: [Tutor]
Hi,
following the example from
http://docs.python.org/3.0/howto/regex.html
If I execute the following code on the python shell (3.1a1):
>>> import re
>>> p = re.compile('ab*')
>>> p
I get the msg:
<_sre.SRE_Pattern object at 0x013A3440>
instead of the msg from the example:
Why I get an SRE_