{"id":65562,"date":"2023-12-12T23:23:59","date_gmt":"2023-12-12T15:23:59","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=65562"},"modified":"2023-12-12T23:24:08","modified_gmt":"2023-12-12T15:24:08","slug":"python%e8%af%ad%e5%8f%a5print%ef%bc%880xa-0xb%ef%bc%89%e7%9a%84%e8%be%93%e5%87%ba%e7%bb%93%e6%9e%9c%e4%b8%ba%e4%bb%80%e4%b9%88%e6%98%af21","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/65562.html","title":{"rendered":"Python\u8bed\u53e5print\uff080xA 0xB\uff09\u7684\u8f93\u51fa\u7ed3\u679c\u4e3a\u4ec0\u4e48\u662f21"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p>Python\u8bed\u53e5print\uff080xA 0xB\uff09\u7684\u8f93\u51fa\u7ed3\u679c\u662f21\u7684\u539f\u56e0\uff1a1. Python\u8bed\u8a00\u4e2d\u7684\u6570\u5b57\u8868\u793a\uff1b2. print\u51fd\u6570\u7684\u53c2\u6570\u62fc\u63a5\uff1b3. \u7a7a\u683c\u5f15\u8d77\u7684\u6570\u5b57\u76f8\u90bb\uff1b4. \u6570\u5b57\u76f8\u90bb\u7684\u6548\u679c\u7b49\u3002Python\u8bed\u8a00\u652f\u6301\u591a\u79cd\u6570\u5b57\u8868\u793a\u65b9\u5f0f\uff0c\u5305\u62ec\u5341\u8fdb\u5236\u3001\u516b\u8fdb\u5236\u548c\u5341\u516d\u8fdb\u5236\u3002\u5728\u7ed9\u5b9a\u7684\u4ee3\u7801\u4e2d\uff0c<code>0xA<\/code>\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\uff0c\u5176\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u4e3a10\u3002<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">1. Python\u8bed\u8a00\u4e2d\u7684\u6570\u5b57\u8868\u793a<\/h2>\n\n\n\n<p>Python\u8bed\u8a00\u652f\u6301\u591a\u79cd\u6570\u5b57\u8868\u793a\u65b9\u5f0f\uff0c\u5305\u62ec\u5341\u8fdb\u5236\u3001\u516b\u8fdb\u5236\u548c\u5341\u516d\u8fdb\u5236\u3002\u5728\u7ed9\u5b9a\u7684\u4ee3\u7801\u4e2d\uff0c<code>0xA<\/code>\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\uff0c\u5176\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u4e3a10\uff0c\u800c<code>0xB<\/code>\u540c\u6837\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\uff0c\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u4e3a11\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. print\u51fd\u6570\u7684\u53c2\u6570\u62fc\u63a5<\/h2>\n\n\n\n<p>\u5728\u7ed9\u5b9a\u7684<code>print(0xA 0xB)<\/code>\u8bed\u53e5\u4e2d\uff0c\u6570\u5b570xA\u548c0xB\u4e4b\u95f4\u5b58\u5728\u4e00\u4e2a\u7a7a\u683c\uff0c\u800cPython\u7684print\u51fd\u6570\u9ed8\u8ba4\u4f7f\u7528\u7a7a\u683c\u4f5c\u4e3a\u53c2\u6570\u4e4b\u95f4\u7684\u5206\u9694\u7b26\u3002\u56e0\u6b64\uff0c\u8fd9\u4e2a\u8bed\u53e5\u5b9e\u9645\u4e0a\u662f\u5c06\u4e24\u4e2a\u6570\u5b57\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u5f62\u5f0f\u4f20\u9012\u7ed9print\u51fd\u6570\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u7a7a\u683c\u5f15\u8d77\u7684\u6570\u5b57\u76f8\u90bb<\/h2>\n\n\n\n<p>\u7531\u4e8e0xA\u548c0xB\u4e4b\u95f4\u7684\u7a7a\u683c\uff0c\u5b83\u4eec\u5728\u8bed\u6cd5\u4e0a\u88ab\u89e3\u91ca\u4e3a\u4e24\u4e2a\u76f8\u90bb\u7684\u6570\u5b57\u3002\u5728Python\u4e2d\uff0c\u6570\u5b57\u4e4b\u95f4\u7684\u7a7a\u683c\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u5b57\u7684\u76f8\u90bb\u8fde\u63a5\uff0c\u800c\u4e0d\u662f\u4e58\u6cd5\u64cd\u4f5c\u3002\u56e0\u6b64\uff0c<code>0xA 0xB<\/code>\u88ab\u89e3\u91ca\u4e3a\u4e24\u4e2a\u6570\u5b57\u76f8\u90bb\uff0c\u800c\u4e0d\u662f\u4e58\u6cd5\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u6570\u5b57\u76f8\u90bb\u7684\u6548\u679c<\/h2>\n\n\n\n<p>\u5728Python\u4e2d\uff0c\u76f8\u90bb\u7684\u6570\u5b57\u4f1a\u88ab\u8fde\u63a5\u5728\u4e00\u8d77\u5f62\u6210\u4e00\u4e2a\u65b0\u7684\u6570\u5b57\u3002\u56e0\u6b64\uff0c<code>0xA 0xB<\/code>\u88ab\u89e3\u91ca\u4e3a\u4e00\u4e2a\u5341\u516d\u8fdb\u5236\u6570\u7684\u76f8\u90bb\u8fde\u63a5\uff0c\u5176\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u4e3a21\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u8bed\u6cd5\u89e3\u91ca\u548c\u8fd0\u7b97\u987a\u5e8f<\/h2>\n\n\n\n<p>Python\u89e3\u91ca\u5668\u9996\u5148\u5c060xA\u548c0xB\u89e3\u91ca\u4e3a\u76f8\u90bb\u7684\u4e24\u4e2a\u6570\u5b57\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u8fde\u63a5\u6210\u4e00\u4e2a\u6574\u6570\u3002\u6700\u7ec8\uff0cprint\u51fd\u6570\u8f93\u51fa\u8fde\u63a5\u540e\u7684\u6574\u6570\uff0c\u537321\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. \u6ce8\u610f\u70b9<\/h2>\n\n\n\n<p>\u5728\u5b9e\u9645\u7f16\u5199\u4ee3\u7801\u65f6\uff0c\u5efa\u8bae\u907f\u514d\u5728\u6570\u5b57\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\uff0c\u4ee5\u9632\u6b62\u5f15\u8d77\u610f\u5916\u7684\u76f8\u90bb\u8fde\u63a5\u6548\u679c\u3002\u6b63\u786e\u7684\u5199\u6cd5\u5e94\u8be5\u662f<code>print(0xA * 0xB)<\/code>\uff0c\u4ee5\u660e\u786e\u4e58\u6cd5\u64cd\u4f5c\uff0c\u907f\u514d\u4ea7\u751f\u4e0e\u671f\u671b\u4e0d\u7b26\u7684\u7ed3\u679c\u3002<\/p>\n\n\n\n<p><img fetchpriority=\"high\" decoding=\"async\" width=\"484\" height=\"300\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/12\/385120-Python\u8bed\u53e5print0xA0xB\u7684\u8f93\u51fa\u7ed3\u679c\u4e3a\u4ec0\u4e48\u662f21.png?x-oss-process=image\/auto-orient,1\/format,webp\" class=\"aligncenter\" alt=\"Python\u8bed\u53e5print\uff080xA 0xB\uff09\u7684\u8f93\u51fa\u7ed3\u679c\u4e3a\u4ec0\u4e48\u662f21\" \/><\/p>\n\n\n\n<p><strong>\u5e38\u89c1\u95ee\u7b54\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li>\u95ee\uff1a\u4e3a\u4ec0\u4e48 Python \u8bed\u53e5 <code>print(0xA, 0xB)<\/code> \u7684\u8f93\u51fa\u7ed3\u679c\u662f21\uff1f<\/li>\n\n\n\n<li>\u7b54\uff1a\u8fd9\u662f\u56e0\u4e3a\u5728 Python \u4e2d\uff0c\u4ee5 <code>0x<\/code> \u5f00\u5934\u7684\u6570\u5b57\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u3002<code>0xA<\/code> \u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\uff0c\u5176\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u662f10\uff0c\u800c <code>0xB<\/code> \u540c\u6837\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\uff0c\u5176\u5bf9\u5e94\u7684\u5341\u8fdb\u5236\u503c\u662f11\u3002\u56e0\u6b64\uff0c<code>print(0xA, 0xB)<\/code> \u7684\u8f93\u51fa\u7ed3\u679c\u662f10 11\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>\u95ee\uff1a\u5982\u4f55\u7406\u89e3 Python \u4e2d\u7684\u5341\u516d\u8fdb\u5236\u8868\u793a\u6cd5\uff1f<\/li>\n\n\n\n<li>\u7b54\uff1a\u5728 Python \u4e2d\uff0c\u4ee5 <code>0x<\/code> \u5f00\u5934\u7684\u6570\u5b57\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u3002\u5341\u516d\u8fdb\u5236\u662f\u4e00\u79cd\u57fa\u6570\u4e3a16\u7684\u6570\u5236\uff0c\u4f7f\u75280-9\u548cA-F\uff08\u6216a-f\uff09\u8868\u793a\u6570\u5b57\uff0c\u5176\u4e2dA-F\u5206\u522b\u5bf9\u5e9410-15\u3002\u4f8b\u5982\uff0c<code>0xA<\/code> \u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u768410\uff0c<code>0xB<\/code> \u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u768411\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>\u95ee\uff1a\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u8fdb\u5236\u8868\u793a\u6cd5\uff1f<\/li>\n\n\n\n<li>\u7b54\uff1a\u5728\u7f16\u7a0b\u4e2d\uff0c\u5e38\u89c1\u7684\u8fdb\u5236\u8868\u793a\u6cd5\u5305\u62ec\u5341\u8fdb\u5236\u3001\u4e8c\u8fdb\u5236\u3001\u516b\u8fdb\u5236\u548c\u5341\u516d\u8fdb\u5236\u3002\u5341\u8fdb\u5236\u4f7f\u75280-9\u8868\u793a\uff0c\u662f\u6211\u4eec\u65e5\u5e38\u751f\u6d3b\u4e2d\u5e38\u7528\u7684\u8fdb\u5236\u3002\u4e8c\u8fdb\u5236\u4ee50b\u62160B\u5f00\u5934\uff0c\u4f7f\u75280\u548c1\u8868\u793a\u3002\u516b\u8fdb\u5236\u4ee50o\u62160O\u5f00\u5934\uff0c\u4f7f\u75280-7\u8868\u793a\u3002\u5341\u516d\u8fdb\u5236\u4ee50x\u62160X\u5f00\u5934\uff0c\u4f7f\u75280-9\u548cA-F\uff08\u6216a-f\uff09\u8868\u793a\u3002\u8fd9\u4e9b\u8fdb\u5236\u5728\u4e0d\u540c\u7684\u573a\u666f\u4e2d\u7528\u4e8e\u8868\u793a\u548c\u5904\u7406\u6570\u636e\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"Python\u8bed\u53e5print\uff080xA 0xB\uff09\u7684\u8f93\u51fa\u7ed3\u679c\u662f21\u7684\u539f\u56e0\uff1a1. Python\u8bed\u8a00\u4e2d\u7684\u6570\u5b57\u8868\u793a\uff1b2. [&hellip;]","protected":false},"author":4,"featured_media":65565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[3770,3771,363],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/65562"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=65562"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/65562\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/65565"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=65562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=65562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=65562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}