Reputation: 56
HTML_BODY= """ <html>
<head>
<title></title>
<style>
table {color: #333;font-family: calibri; width: 80%%;border-collapse:collapse; border-spacing: 0;}
td, th { border: 1px solid #CCC;width:100px; height: 30px; }
th {background: #F3F3F3;font-weight: bold;font-size: 13px;}
td {background: #FAFAFA;text-align: center; font-size: 12px;}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<th>
S.No.</th>
<th>
Scenario Name</th>
<th>
Total Test Cases</th>
<th>
Passed Test Cases</th>
<th>
Failed Test Cases</th>
</tr>
<tr>
<td>
1</td>
<td>
%s%</td>
<td>
%s%</td>
<td>
<span style="color:#008000;">%s%</span></td>
<td>
<span style="color:#ff0000;">%s%</span></td>
</tr>
</tbody>
</table>
<p>
</p>
<table>
<tbody>
<tr>
<th>
Total Scenario</th>
<th>
Total Test Cases</th>
<th>
Passed Test Cases</th>
<th>
Failed Test Cases</th>
</tr>
<tr>
<td>
%s%</td>
<td>
%s%</td>
<td style="color:#008000;">
%s%</td>
<td style="color:#ff0000;">
%s%</td>
</tr>
</tbody>
</table>
<p>
</p>
</body>
""" %(self.__flow,self.__totalflowtestcases,self.__flowtestpass,self.__flowtestfail,self.__alltestcases,self.__alltestcases,self.__testpass,self.__testfail)
and then i am getting error : ValueError: unsupported format character '<' (0x3c) at index 3
Upvotes: 0
Views: 2478
Reputation: 59425
The problem is this line(s):
%s%</td>
%<
is assumed a format string by Python interpreter. If you want to print %
sign inside a format string, use %%
, ie:
%s%%</td>
Upvotes: 6