Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
thank you all.



__

New Online ID Theft Protection - http://www.tiscali.co.uk/spyguard

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread Kent Johnson
On Wed, Jun 11, 2008 at 5:35 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi,
> Silly question but how do you use python's re module to find
> dictionary items that contain the '$' symbol.

There is no need to use re for this.
[ v for v in d.values() if '$' in v ]
will give you a list of all values containing '$'.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread kinuthiA muchanE


> --
> 
> Message: 4
> Date: Wed, 11 Jun 2008 10:35:30 +0100 (GMT+01:00)
> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> Subject: [Tutor] RegEx to search for the '$' symbol
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain;charset="UTF-8"
> 
> Hi,
> Silly question but how do you use python's re module to find 
> dictionary items that contain the '$' symbol.
Hi, 
I no expert but here is my dime's worth...

> >>> import re
> >>> d = {'k':'$',1:'2','p':'$','j':'$dollar','l': 'dol$lar'}
> >>> for i in d.values():
> ... re.findall(r'.*\$.*',i)
> ... 
> 
> []
> ['$']
> ['$dollar']
> ['dol$lar']
> []
> 
> NB:
> Empty matches are included in the result unless they touch the beginning of 
> another match. 
> 
>  
> 
 Kinuthia...


> Thanks
> David
> 
> 
> 
> 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
Hi,
Silly question but how do you use python's re module to find 
dictionary items that contain the '$' symbol.
Thanks
David



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor