On 4/3/2011 6:07 AM, Alia Khouri wrote:
Hi folks,
I've been using ironpython2.7 in a project, and I was generating some
csharp code when i discovered that I couldn't use use str.format
because the interference with the brackets-aplenty situation in
csharp.
In [1]: code = "class {0}Model { public bool IsModel(){ return
true; } }"
In [2]: code.format('My')
Just double the brackets, just as one doubles '\\' to get '\' in a string.
>>> "class {0}Model {{ public bool IsModel(){{ returntrue; }}
}}".format('My')
'class MyModel { public bool IsModel(){ returntrue; } }'
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list