简体   繁体   English

ValueError:索引3处不支持的格式字符'<'(0x3c)

[英]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>
        &nbsp;</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>
        &nbsp;</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.

相关问题 Python,Django:ValueError:索引3处不受支持的格式字符&#39;(&#39;(0x28) - Python, Django: ValueError: unsupported format character '(' (0x28) at index 3 ValueError:索引79处不支持的格式字符&#39;a&#39;(0x61) - ValueError: unsupported format character 'a' (0x61) at index 79 Python:ValueError:索引1处不支持的格式字符&#39;&#39;&#39;(0x27) - Python: ValueError: unsupported format character ''' (0x27) at index 1 ValueError:索引 650 处不支持的格式字符 &#39;w&#39; (0x77) - ValueError: unsupported format character 'w' (0x77) at index 650 ValueError:索引处不支持的格式字符&#39;{&#39;(0x7b) - ValueError: unsupported format character '{' (0x7b) at index ValueError: 不支持的格式字符 &#39;p&#39; (0x70) 在索引 7 - ValueError: unsupported format character 'p' (0x70) at index 7 ValueError:索引798处不支持的格式字符&#39;P&#39;(0x50) - ValueError: unsupported format character 'P' (0x50) at index 798 ValueError: 索引 21 处不支持的格式字符 ')' (0x29) - ValueError: unsupported format character ')' (0x29) at index 21 ValueError:不支持的格式字符“!” (0x21) 在索引 2235 - ValueError: unsupported format character '!' (0x21) at index 2235 ValueError:不支持的格式字符&#39;C&#39;(0x43) - ValueError: unsupported format character 'C' (0x43)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM