{"id":1017,"date":"2023-03-24T09:47:07","date_gmt":"2023-03-24T01:47:07","guid":{"rendered":""},"modified":"2023-03-24T09:47:07","modified_gmt":"2023-03-24T01:47:07","slug":"Python \u53d8\u91cf","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1017.html","title":{"rendered":"Python \u53d8\u91cf"},"content":{"rendered":"
\n
\u641e\u61c2Python\u53d8\u91cf\u58f0\u660e\u3001\u5b58\u50a8\u548c\u57fa\u672c\u89c4\u5219<\/span>\n <\/div>\n \u53d8\u91cf\u662f\u4e00\u79cd\u8f7d\u4f53\uff0c\u4e3b\u8981\u7528\u4e8e\u5b58\u50a8\u6570\u636e\u3002<\/span> \u53d8\u91cf\u540d\u5fc5\u987b\u4ee5\u5b57\u6bcd\u6216\u4e0b\u5212\u7ebf\u5b57\u7b26\u5f00\u5934\uff0c\u4e0d\u80fd\u4ee5\u6570\u5b57\u5f00\u5934\u3002<\/span> <\/body>\u53d8\u91cf\u7684\u4f5c\u7528<\/h2>\n
\n \u53d8\u91cf\u7684\u503c\u53ef\u4ee5\u88ab\u8bfb\u53d6\u548c\u4fee\u6539\u3002<\/span>
\n \u53d8\u91cf\u4e0d\u9700\u8981\u5355\u72ec\u58f0\u660e\uff0c\u9996\u6b21\u8d4b\u503c\u65f6\u5c31\u4f1a\u88ab\u521b\u5efa.<\/span> <\/p>\n\u53d8\u91cf\u7684\u547d\u540d\u89c4\u8303<\/h2>\n
\n \u53d8\u91cf\u540d\u79f0\u7531\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u5b57\u7b26\u548c\u4e0b\u5212\u7ebf\uff08A-z\u30010-9 \u548c _\uff09\u7ec4\u6210<\/span>
\n \u53d8\u91cf\u540d\u79f0\u533a\u5206\u5927\u5c0f\u5199\uff08a\u3001A\u662f2\u4e2a\u4e0d\u540c\u7684\u53d8\u91cf\uff09\u3002<\/span> <\/p>\n\u53d8\u91cf\u7684\u7528\u6cd5<\/h2>\n
a = 1<\/span>
print(a<\/span>)<\/span> \n
<\/code><\/pre>\n<\/p><\/div>\n1<\/span><\/code><\/pre>\n<\/p><\/div>\n
a = 1<\/span>
b = \"Hello World\uff01\"<\/span>
print(a<\/span>)<\/span> \n
print( \nb<\/span>)<\/code><\/pre>\n<\/p><\/div>\n1
Hello World\uff01<\/span><\/code><\/pre>\n<\/p><\/div>\n a = \"Hello\"<\/span>
a = \"World\"<\/span>
print(a<\/span>)<\/span><\/code><\/pre>\n<\/p><\/div>\nWorld<\/span><\/code><\/pre>\n<\/p><\/div>\n
a, b, c = \"cat\", \"dog\", \"cow\"<\/span>
print(a<\/span>)
print(b<\/span>)
print(c<\/span>)<\/span><\/code><\/pre>\n<\/p><\/div>\ncat<\/span> \n
\ndog<\/span> \n
\ncow<\/span><\/code><\/pre>\n<\/p><\/div>\n a = b = c = \"cat\"<\/span>
print(a<\/span>) print(b<\/span>)
print(c<\/span>)<\/span><\/code><\/pre>\n<\/p><\/div>\ncat<\/span> \n
\ncat<\/span> \n
\ncat<\/span><\/code><\/pre>\n<\/p><\/div>\n a = 1<\/span>
b = 2<\/span>
x = a+b<\/span>
print(x<\/span>)<\/span><\/code><\/pre>\n<\/p><\/div>\n3<\/span><\/code><\/pre>\n<\/p><\/div>\n
# -*- coding=utf-8 -*-<\/span>
a = \"Hello\"<\/span>
def<\/span> test():
a = \"World\"<\/span>
print(\"\u5c40\u90e8\u53d8\u91cf\u7684\u503c\u662f\uff1a \" + a<\/span>)
test()<\/span><\/span><\/code><\/pre>\n<\/p><\/div>\n\u5c40\u90e8\u53d8\u91cf\u7684\u503c\u662f\uff1a World
\u5168\u5c40\u53d8\u91cf\u7684\u503c\u662f\uff1aHello<\/span><\/code><\/pre>\n<\/p><\/div>\n def<\/span> myfunc():
global<\/span> a
a = \"Hello World\"<\/span>
myfunc()<\/span> print(\"\u5168\u5c40\u53d8\u91cf\u7684\u503c\uff1a\" + a<\/span>)<\/span><\/code><\/pre>\n<\/p><\/div>\n\u5168\u5c40\u53d8\u91cf\u7684\u503c\uff1aHello World<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Python \u53d8\u91cfzh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[126],"tags":[],"class_list":["post-1017","post","type-post","status-publish","format-standard","hentry","category-python3"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1017"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1017"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1017\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}