Ho to use a regular expression group reference as hash key

Andreas Martin a.martin at perfectwww.de
Wed Mar 13 12:20:03 EST 2002


Ahh.. the % substitution operator is perfect. First I didn't
understand what to do with an %s format string.

Thank you

"Raymond Hettinger" <python at rcn.com> wrote in message news:<a6jve0$t1h$1 at bob.news.rcn.net>...
> Maybe the % substitution operator will help.
> 
> >>> person={"entry1":"value1","entry2":"value2"}
> >>> target = 'A sample sentence with %(entry1)s and %(entry2)s'
> >>> print target % person
> A sample sentence with value1 and value2



More information about the Python-list mailing list