0

I want to do the following

"@file %(unitname).C" % {'unitname':'Test'}

but it complains about the '.C'. How can I escape the '.' character?

2 Answers 2

7

You don't. You fix the format specifier.

"@file %(unitname)s.C" % {'unitname':'Test'}
Sign up to request clarification or add additional context in comments.

Comments

0

Another option is,

"@file {unitname}.C".format(unitname='Test')

This may be preferable, since format() will be the new standard in Python 3.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.