
July 20, 2015
2:04 a.m.
On Mon, Jul 20, 2015 at 9:50 AM, Terry Reedy <tjreedy@udel.edu> wrote:
On 7/19/2015 7:12 PM, Mike Miller wrote:
Have long wished python could format strings easily like bash or perl do, ... and then it hit me:
csstext += f'{nl}{selector}{space}{{{nl}'
Are the unbalanced braces here and in the followup intentional?
I expect they are - compare the percent formatting example:
csstext += '%s%s%s{%s' % (nl, key, space, nl)
The double open brace makes for a literal open brace in the end result. It's the same ugliness as trying to craft a regular expression to match Windows path names without raw string literals, so I completely sympathize with the desire for something better. But I don't think f"fmt" is it :) ChrisA