Reputation: 13
I'm writing a multi-line file, lines like:
workspace -fr "fluidCache" "cache/nCache/fluid";
On some of the lines I need to use a variable containing a file path, when I use the following:
render_output = os.path.join(project_root, r'common\render_output')
ws_file.write("""workspace -fr "images" {0};""".format(render_output))
result:
workspace -fr "images" I:\..\common\render_output;
The result I need is render_output with quotes:
workspace -fr "images" "I:\..\common\render_output";
How might I format the render_output so that the quotations of its string value are maintained in the triple quoted write argument?
Upvotes: 0
Views: 112
Reputation: 11641
ws_file.write("""workspace -fr "images" "{0}";""".format(render_output))
Upvotes: 2