[英]ValueError: unsupported format character '<' (0x3c) at index 3
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) “”“%(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 然后我得到错误:ValueError:索引3处不支持的格式字符'<'(0x3c)
The problem is this line(s): 问题是此行:
%s%</td>
%<
is assumed a format string by Python interpreter. Python解释器假定%<
为格式字符串。 If you want to print %
sign inside a format string, use %%
, ie: 如果要在格式字符串中打印%
符号,请使用%%
,即:
%s%%</td>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.