> ------------------------------
>
> 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: [email protected]
> 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 - [email protected]
http://mail.python.org/mailman/listinfo/tutor