{"id":187460,"date":"2020-11-06T10:54:02","date_gmt":"2020-11-06T02:54:02","guid":{"rendered":"http:\/\/4563.org\/?p=187460"},"modified":"2020-11-06T10:54:02","modified_gmt":"2020-11-06T02:54:02","slug":"python-%e6%b1%82%e5%8a%a9","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=187460","title":{"rendered":"Python \u6c42\u52a9"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python \u6c42\u52a9               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e8b\u60c5\u539f\u672c\u6bd4\u8f83\u7b80\u5355, \u6211\u60f3\u628a json \u5b58\u5165\u6570\u636e\u5e93, \u7ed3\u679c\u6211\u7528 python json.dumps()\u628a\u6570\u636e\u8f6c\u4e3a json, \u81ea\u52a8\u8f6c\u6210\u4e86 unicode \u5b57\u7b26\u4e32, \u6211\u4e5f\u6ca1\u5728\u610f, \u4e0d\u8fc7\u5b58\u5165\u4e86\u6570\u636e\u5e93, unicode \u7684\u53cd\u659c\u6760\u4e0d\u89c1\u4e86,\u53d6\u51fa\u6765\u4e5f\u6ca1\u6709, \u88ab mysql \u7684 json \u5751\u60e8\u4e86, \u53ea\u6709\u4e00\u4e2a uxxxx, \u800c\u4e0d\u662fuxxxx , \u91cc\u8fb9\u5939\u6742\u4e86\u6ca1\u6709\u8f6c\u6210 unicode \u5b57\u7b26\u4e32\u7684 \u6bd4\u5982\u82f1\u6587\u6570\u5b57\u4e4b\u7c7b\u7684, \u6211\u8be5\u600e\u4e48\u6b63\u5e38\u4e3a\u4e2d\u6587\u5462, \u4e4b\u524d\u66ff\u6362, \u8001\u5f0f\u51fa\u73b0\u9519\u8bef. \u73b0\u5728\u5b57\u7b26\u4e32\u5168\u662f\u8fd9\u79cd. \u5927\u4f6c\u4eec, \u6211\u8be5\u600e\u4e48\u529e\u5462. eg: u9ad8u9e97u5c4bu4e09u4ee3u8972u540d u516bu4ee3u76ee u5e02u5dddu67d3u4e94u90ce u5bc6u77403650u65e5 u8bf7u4ee5u4f60u7684u540du5b57u547cu5524u6211<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>19<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4075137\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ipwx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u731c\u4f60\u5b58\u8fdb\u6570\u636e\u5e93\u7684\u65f6\u5019\uff0c\u65e2\u6ca1\u6709\u7528 ORM \u4e5f\u6ca1\u6709\u7528 prepared statement \u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075138\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : l4ever <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             pymysql.escape_string()                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075139\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ipwx \u6ca1\u6709, \u56fe\u7b80\u5355, \u5f53\u65f6\u4e00\u65f6\u76f4\u63a5\u7528\u7684 pymysql&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075140\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GodFastion <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             for \u904d\u5386\u4e00\u4e0b\uff0c\u6bcf\u4e2a u \u524d\u9762\u52a0\u4e2a\u659c\u6760                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075141\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @GodFastion \u4e0d\u884c\u989d, \u4e4b\u524d\u6211\u662f\u66ff\u6362\u7684, \u603b\u4f1a\u51fa\u4e00\u4e9b\u9519&#8230; \u6211\u90fd\u75af\u4e86&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075142\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ferock <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u8981\u8f6c unicode \u4e0d\u5c31\u884c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075143\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ferock \u95ee\u9898\u662f\u6211, \u5df2\u7ecf\u5f04\u4e86\u51e0\u5341\u4e07\u7684\u6570\u636e\u4e86, \u73b0\u5728\u5df2\u7ecf\u665a\u4e86. \u53ea\u6709\u60f3\u529e\u6cd5\u628a\u53cd\u659c\u6760\u52a0\u4e0a\u53bb&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075144\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u80fd\u8f6c\u6210\u529f\u4e00\u90e8\u5206, \u4f46\u662f\u4e00\u8d77\u8f6c\u6210\u6c49\u5b57\u91cd\u4f1a\u51fa\u9519\u4e00\u4e9b&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075145\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ungrown <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @leeguo #8 <br \/>\u51fa\u9519\u7684\u4f8b\u5b50\u7ed9\u4e00\u4e0b<br \/>\u5305\u62ec\u6570\u636e\u5e93\u91cc\u5e26 u \u7684\u5b57\u7b26\u4e32\u3001\u9884\u671f\u7684\u539f\u5b57\u7b26\u4e32\u3001\u62a5\u9519                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075146\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u4e0d\u5982\u518d\u8f6c\u4e00\u6b21\uff0cupdate<br \/>\u60f3\u6e05\u8f6c json \u695a\u7559\u4e0d\u7559\u6c49\u5b57\uff0c\u6216\u8005\u5165\u5e93\u7528\u4ec0\u4e48 sql \u8bed\u53e5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075147\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lxilu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             u[a-f0-9]{4}\u4e0d\u884c\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075148\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8c22\u8c22\u5404\u4f4d\u4e86, \u6211\u627e\u5230\u95ee\u9898\u6240\u5728\u4e86, \u5f04\u597d\u4e86 unicode, \u5728\u8f6c\u56de\u53bb, \u53ef\u80fd\u4e0d\u662f\u6211\u8f6c json \u7684\u95ee\u9898, \u800c\u662f\u8f6c\u4e86 json, \u7136\u540e\u518d\u6b21\u5b58\u50a8\u8fc7\u7a0b\u4e2d, \u6709\u51e0\u6761\u6570\u636e json \u6570\u636e, \u65e0\u6cd5\u5b58\u50a8, \u5177\u4f53\u95ee\u9898\u4e0d\u77e5\u9053, \u4f46\u9519\u8bef\u7387\u53ef\u80fd\u5728 1\/1000 \u4e00\u4e0b, \u4f46\u6570\u636e\u6bd4\u8f83\u591a, \u6240\u4ee5\u5f04\u4e86\u5f88\u591a\u6b21\u4ee5\u559c\u7231\u5728\u5c31\u9519\u8bef\u4e86, \u8c22\u8c22\u5404\u4f4d\u4e86, \u8fd9\u4e48\u665a\u4e86, \u5148\u4f11\u606f\u5427, \u6211\u660e er \u770b\u770b\u4e3a\u4ec0\u4e48\u90a3\u51e0\u6761 json \u5b58\u4e0d\u8fdb\u53bb&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075149\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : HuberyPang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u6211\u9047\u5230\u8fc7\uff0c\u5c31\u662f\u8f6c\u4e49\u7684\u95ee\u9898\u3002\u6570\u636e\u5b58\u5165 MySQL \u65f6\uff0c\u4f1a\u88ab\u8f6c\u4e49\u4e3a\u7a7a\u3002json.dumps(, ensure_ascii=False)\u5c31\u884c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075150\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @HuberyPang \u662f\u7684,\u6211\u4e4b\u524d\u6ca1\u6ce8\u610f, \u5b58\u4e86\u51e0\u5341\u4e07\u6570\u636e\u4e4b\u540e\u624d\u53d1\u73b0&#8230;..                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075151\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ungrown <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @leeguo #14 MySQL \u6211\u4e0d\u719f\uff0c\u5982\u679c\u4e0d\u652f\u6301 Unicode \u5b57\u7b26\u4e32\u7684\u8bdd\uff0c\u53ef\u4ee5\u8003\u8651 base64                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075152\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ipwx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ungrown \u7528 prepared statement + \u53c2\u6570\u7ed1\u5b9a\uff0c\u624b\u62fc\u5b57\u7b26\u4e32\u4f1a\u51fa\u95ee\u9898\u5f88\u6b63\u5e38\u3002\u5982\u679c\u4e00\u5b9a\u8981\u624b\u62fc\uff0c2L \u5df2\u7ecf\u7ed9\u51fa\u7b54\u6848\u4e86\uff0cescape_string() &#8230;<\/p>\n<p>\u4e3b\u4f60\u5bf9\u4e8c\u7684\u6b63\u786e\u7b54\u6848\u90fd\u65e0\u89c6\u4e86\u597d\u4e0d\u597d\u3002\u3002\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075153\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ipwx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ungrown \u8fd9\u6839\u672c\u4e0d\u662f MySQL \u662f\u4e0d\u662f\u652f\u6301 unicode \u5b57\u7b26\u4e32\uff0c\u611f\u89c9\u662f\u4e3b\u53ef\u80fd\u4e0d\u61c2 escape \u662f\u548b\u56de\u4e8b\u3002\u3002\u8fd8\u6709\u5c31\u662f unicode &amp; utf-8 \u8fd9\u4e24\u8005\u4e3b\u4e5f\u9700\u8981\u4e86\u89e3\u4e00\u4e0b\uff0cmysql \u9ed8\u8ba4\u4ee5 utf-8 \u5b58\u50a8\u5b57\u7b26\u4e32\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075154\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : leeguo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ipwx @-@&#8230; \u6211\u770b\u4e86\u4e00\u4e0b, \u6ca1\u770b\u52a8,\u5c31\u627e\u5176\u4ed6\u65b9\u6cd5\u4e86, \u8c22\u8c22\u4e86, \u6211\u5728\u770b\u770b&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4075155\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u60f3\u8c61\u5b83\u662f\u4e00\u4e2a LL(4) \u7684\u7f16\u7a0b\u8bed\u8a00\u5199\u4e2a\u89e3\u91ca\u5668\u5427\uff0c\u7136\u540e\u5168\u90e8\u91cd\u65b0 update \u8fc7\u4e00\u904d<\/p>\n<p>\u65b9\u4fbf\u8fd8\u662f ORM \u65b9\u4fbf\uff0c\u4e3b\u8981\u662f\uff0c\u6709\u5bf9\u6570\u636e\u5e93\u7684\u9632\u5fa1\u6027\u7f16\u7a0b\u601d\u60f3\u5728\u7684\u8bdd\uff0c\u624b\u5199 SQL \u603b\u662f\u601d\u524d\u60f3\u540e\uff0c\u5bf9\u6bd4\u8d77\u6765 ORM \u662f\u771f\u7684\u65b9\u4fbf                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python \u6c42\u52a9 \u8cc7\u6df1\u5927\u4f6c : &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187460"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187460"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187460\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187460"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}