I am creating an HTML output file using vanilla Python 3 and I wish to use the multi-tab layout (http://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_tabs_close) to help organize my presentation.
When trying to print:
' <li><a href="#" class="tablinks active" onclick="openTab(event, 'Faults')"><b>Faults</b></a></li>'
'partial string {}Faults{} more string'.format("'","'")
' <li><a href="#" class="tablinks active" onclick="openTab(event, \'Faults\')"><b>Faults</b></a></li>)'
b = ' <li><a href="#" class="tablinks active" onclick="openTab(event, '
c = "'Faults'"
d = ')"><b>Faults</b></a></li>)
('').join([b,c,d])
' <li><a href="#" class="tablinks active" onclick="openTab(event, \'Faults\')"><b>Faults</b></a></li>)'
' <li><a href="#" class="tablinks active" onclick="openTab(event, \'Faults\')"><b>Faults</b></a></li>'
You need to escape single quotes in single quotes. If you write this to a file, it will be how you want it.
Or use ''' <li><a href="#" class="tablinks active" onclick="openTab(event, \'Faults\')"><b>Faults</b></a></li>'''
Notice the triple quotes?
Interesting article about escaping in Python: Learn Python the hard way