On 28/02/2013 14:42, Helmut Jarausch wrote:
On Fri, 01 Mar 2013 01:22:48 +1100, Chris Angelico wrote:

On Fri, Mar 1, 2013 at 1:11 AM, Helmut Jarausch <jarau...@skynet.be>
wrote:
Hi,

I'd like to print a string with the string format method which uses
{0}, ...

Unfortunately, the string contains TeX commands which use lots of
braces. Therefore I would have to double all these braces just for the
format method which makes the string hardly readable.

Is there anything like a "raw" format string and any other means to
circumvent this?

You could use a different string formatting function, such as
percent-formatting:

"Hello, {0}, this is %s" % some_string

The {0} will be output literally, and the %s will be replaced by the
string. Braces are ignored, percent signs are significant.

ChrisA

Originally I had used percent-formatting
But isn't  it deprecated in Python 3.X ?

Thanks,
Helmut.


Nope please see http://mail.python.org/pipermail/python-dev/2012-February/116790.html

--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to