How to escape char in Python 3 ''' string?

Here is the String:

'''This is a test { <-- escape these ---> } '''

I would like to escape the

{

and

}

in format method, how can I do so? Thanks.

Answers


Format String Syntax:

If you need to include a brace character in the literal text, it can be escaped by doubling: {{ and }}.

Try this:

'''This is a test {{ <-- escape these ---> }} and the value is {0}'''.format(42)

Need Your Help

check if checkbox has been checked using ScrewDefaultButtons plugin

jquery checkbox

If I wanted to check if an ordinary checkbox has been checked, I would use something like the following:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.