raw format string in string format method?
Chris Angelico
rosuav at gmail.com
Thu Feb 28 09:22:48 EST 2013
More information about the Python-list mailing list
Thu Feb 28 09:22:48 EST 2013
- Previous message (by thread): raw format string in string format method?
- Next message (by thread): raw format string in string format method?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Mar 1, 2013 at 1:11 AM, Helmut Jarausch <jarausch at 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
- Previous message (by thread): raw format string in string format method?
- Next message (by thread): raw format string in string format method?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list