{"id":200881,"date":"2020-11-23T18:00:08","date_gmt":"2020-11-23T10:00:08","guid":{"rendered":"http:\/\/4563.org\/?p=200881"},"modified":"2020-11-23T18:00:08","modified_gmt":"2020-11-23T10:00:08","slug":"%e9%9a%be%e9%81%93%e6%88%91%e7%9a%84-py-%e5%92%8c%e4%bd%a0%e4%bb%ac%e7%9a%84%e4%b8%8d%e4%b8%80%e6%a0%b7%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=200881","title":{"rendered":"\u96be\u9053\u6211\u7684 py \u548c\u4f60\u4eec\u7684\u4e0d\u4e00\u6837\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u96be\u9053\u6211\u7684 py \u548c\u4f60\u4eec\u7684\u4e0d\u4e00\u6837\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : h175h32 <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e3a\u5565\u6211\u6267\u884c\u8fd9\u4e2a<\/p>\n<pre><code>import urllib.parse print(urllib.parse.urlencode(\"\u4e2d\u6587\"))  <\/code><\/pre>\n<p>\u90fd\u62a5\u9519\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>13<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4301156\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : westoy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             urlencode \u7684\u4e0d\u662f dict \u4e48, \u4f60\u8981\u7684\u662f quote \u5427&#8230;&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301157\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : h175h32 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u64e6 \u641c\u4e86\u534a\u5929 \u539f\u6765 python3.0 \u540e\u7684\u7f16\u7801\u5668 urlencode \u66f4\u65b0\u540e\u6539\u4e3a quote_plus\uff0c\u51fd\u6570\u540d\u6539\u4e86 \u53ef\u662f\u767e\u5ea6\u641c\u5230\u8fd8\u6709\u5f88\u591a\u7528\u8fd9\u4e2a urlencode \u51fd\u6570\u7684\u6587\u7ae0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301158\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : h175h32 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @westoy \u53ea\u662f\u60f3\u7528 urlencode \u7f16\u7801\u4e00\u4e0b\u8fd9\u4e2a\u53d8\u91cf                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301159\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : summerwar <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u641c\u95ee\u9898\u7684\u65f6\u5019\u52a0\u4e0a python3 \u5426\u5219\u641c\u51fa\u6765\u7684\u53ef\u80fd\u662f 2.7 \u7684\u7b54\u6848                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301160\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : westoy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @h175h32 <\/p>\n<p>python \u91cc urlencode \u548c quote\/quote_plus \u672c\u8eab\u4f7f\u7528\u6ca1\u53d8\u8fc7\uff0c \u4e00\u76f4\u662f\u90a3\u6837\uff0c \u6211\u6000\u7591\u4f60\u628a php \u7684 urlencode \u7ed9\u8bb0\u53c9\u4e86&#8230;.<\/p>\n<p>\u53ea\u662f 2.7 \u65f6 urlencode \u3001quote\/quote_plus \u662f\u5728 urllib \u4e0b\u9762\uff0c \u539f\u672c\u7684 urlparse \u66f4\u4fa7\u91cd\u89e3\u6790 url\uff0c \u73b0\u5728\u7edf\u4e00\u79fb\u5230\u4e86 urllib.parse \u4e0b\u9762                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301161\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : thedrwu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6807\u9898\u7528\u8fd9\u4e2a\u7f29\u5199\u6709\u70b9\u6b67\u4e49                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301162\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : roudancongji <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e0d\u662f\u6211\u60f3\u770b\u7684 py                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301163\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : AndyAO <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @h175h32 #2 <br \/>\u5efa\u8bae\u641c\u8fd9\u7c7b\u95ee\u9898\u7684\u65f6\u5019,\u9650\u5236\u65f6\u95f4\u4e3a 1 \u5e74,\u800c\u4e14\u5c4f\u853d\u6389 CSDN \u7b49\u7ad9,\u7ed3\u679c\u4f1a\u6bd4\u8f83\u597d.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301164\" 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>                                                             print(urllib.parse.urlencode({&#8216;s&#8217;:&#8221;\u4e2d\u6587&#8221;}))<br \/>s=%E4%B8%AD%E6%96%87<\/p>\n<p>print(urllib.parse.quote(&#8220;\u4e2d\u6587&#8221;))<br \/>%E4%B8%AD%E6%96%87                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301165\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qfans67 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             py \u901a\u7ea2\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301166\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bugcoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Not py diff, but search engine diff                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301167\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @h175h32 \u56e0\u4e3a\u4f60\u641c\u7d22\u65b9\u6cd5\u6709\u95ee\u9898<br \/>\u522b\u7528\u767e\u5ea6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4301168\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kevinfk2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4ee5\u4e3a\u662f py                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u96be\u9053\u6211\u7684 py \u548c\u4f60\u4eec\u7684\u4e0d\u4e00\u6837\uff1f &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\/200881"}],"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=200881"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/200881\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=200881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=200881"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=200881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}