Re: [Tutor] How to control the not existent keys in a dict

2009-05-11 Thread Emilio Casbas
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 = {'

[Tutor] How to control the not existent keys in a dict

2009-05-10 Thread Emilio Casbas
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

Re: [Tutor] Regular Expresions instances

2009-04-29 Thread Emilio Casbas
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]

[Tutor] Regular Expresions instances

2009-04-28 Thread Emilio Casbas
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_