{"id":205245,"date":"2025-05-29T13:30:54","date_gmt":"2025-05-29T05:30:54","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205245\/"},"modified":"2025-05-29T13:30:54","modified_gmt":"2025-05-29T05:30:54","slug":"python-3-%e8%84%9a%e6%9c%ac%e6%8a%a5%e9%94%99typeerror-not-all-arguments-converted-during-string-formatting%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205245\/","title":{"rendered":"Python 3 \u811a\u672c\u62a5\u9519\u201cTypeError: not all arguments converted during string formatting\u201d\u5982\u4f55\u89e3\u51b3\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python 3 \u811a\u672c\u62a5\u9519\u201cTypeError: not all arguments converted during string formatting\u201d\u5982\u4f55\u89e3\u51b3\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241127\/173267538267468736b8d47.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python 3 \u6267\u884c\u811a\u672c\u62a5\u9519\u201ctypeerror: not all arguments converted during string formatting\u201d<\/strong><\/p>\n<p>\u5728\u6267\u884c python 3 \u811a\u672c\u65f6\uff0c\u9047\u5230\u4e86\u4e00\u4e2a\u5e38\u89c1\u7684\u9519\u8bef\uff1a\u201ctypeerror: not all arguments converted during string formatting\u201d\u3002\u6b64\u9519\u8bef\u4e00\u822c\u7531\u4ee5\u4e0b\u539f\u56e0\u9020\u6210\uff1a<\/p>\n<p>\u4ee3\u7801\u4e2d\u5b58\u5728\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08\u4f8b\u5982 &#8216;%s&#8217; % some_variable\uff09\uff0c\u4f46\u6ca1\u6709\u63d0\u4f9b\u8db3\u591f\u7684\u53c2\u6570\u6765\u5339\u914d\u5360\u4f4d\u7b26\u3002<br \/>\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0c\u51fa\u73b0\u6b64\u9519\u8bef\u7684\u8bed\u53e5\u662f\uff1a<\/p>\n<pre>out_tgt.write('%s\\n' % rows)<\/pre>\n<p>\u5176\u4e2d\uff0crows \u662f\u4e00\u4e2a\u5143\u7ec4\uff0c\u5305\u542b\u6570\u636e\u5e93\u67e5\u8be2\u7684\u7ed3\u679c\u3002\u7136\u800c\uff0c&#8217;%s&#8217; \u5360\u4f4d\u7b26\u671f\u671b\u4e00\u4e2a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u53c2\u6570\uff0c\u56e0\u6b64\u51fa\u73b0\u4e86\u9519\u8bef\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u9700\u8981\u786e\u4fdd\u4e3a\u6240\u6709\u5360\u4f4d\u7b26\u63d0\u4f9b\u6b63\u786e\u7684\u53c2\u6570\u3002\u5728\u7ed9\u5b9a\u7684\u793a\u4f8b\u4e2d\uff0c\u53ef\u4ee5\u5c06\u4ee3\u7801\u66f4\u6539\u4e3a\uff1a<\/p>\n<pre>out_tgt.write('%s\\n' % (rows,))<\/pre>\n<p>\u62ec\u53f7 () \u786e\u4fdd rows \u88ab\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u4e14\u6210\u529f\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aPython 3 \u811a\u672c\u62a5\u9519\u201cTypeError: not all arguments converted during string formatting\u201d\u5982\u4f55\u89e3\u51b3\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python 3 \u811a\u672c\u62a5\u9519\u201cTy&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205245","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205245"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205245\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}