﻿{"id":453,"date":"2011-05-06T12:56:19","date_gmt":"2011-05-06T04:56:19","guid":{"rendered":"http:\/\/nick.workao.org\/?p=453"},"modified":"2011-05-06T13:13:56","modified_gmt":"2011-05-06T05:13:56","slug":"python%e5%85%a5%e9%97%a8%e6%95%99%e7%a8%8b-%e8%b6%85%e8%af%a6%e7%bb%861%e5%b0%8f%e6%97%b6%e5%ad%a6%e4%bc%9apython","status":"publish","type":"post","link":"http:\/\/nick.txtcc.com\/index.php\/python\/453","title":{"rendered":"Python\u5165\u95e8\u6559\u7a0b \u8d85\u8be6\u7ec61\u5c0f\u65f6\u5b66\u4f1aPython"},"content":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u4f7f\u7528Python\n\u5047\u8bbe\u6211\u4eec\u6709\u8fd9\u4e48\u4e00\u9879\u4efb\u52a1:\u7b80\u5355\u6d4b\u8bd5\u5c40\u57df\u7f51\u4e2d\u7684\u7535\u8111\u662f\u5426\u8fde\u901a.\u8fd9\u4e9b\u7535\u8111\u7684ip\u8303\u56f4\u4ece192.168.0.101\u5230192.168.0.200.<\/p>\n<p>\u601d\u8def:\u7528shell\u7f16\u7a0b.(Linux\u901a\u5e38\u662fbash\u800cWindows\u662f\u6279\u5904\u7406\u811a\u672c).\u4f8b\u5982,\u5728Windows\u4e0a\u7528ping ip \u7684\u547d\u4ee4\u4f9d\u6b21\u6d4b\u8bd5\u5404\u4e2a\u673a\u5668\u5e76\u5f97\u5230\u63a7\u5236\u53f0\u8f93\u51fa.\u7531\u4e8eping\u901a\u7684\u65f6\u5019\u63a7\u5236\u53f0\u6587\u672c\u901a\u5e38\u662f&#8221;Reply from &#8230; &#8221; \u800c\u4e0d\u901a\u7684\u65f6\u5019\u6587\u672c\u662f&#8221;time out &#8230; &#8221; ,\u6240\u4ee5,\u5728\u7ed3\u679c\u4e2d\u8fdb\u884c\u5b57\u7b26\u4e32\u67e5\u627e,\u5373\u53ef\u77e5\u9053\u8be5\u673a\u5668\u662f\u5426\u8fde\u901a.<\/p>\n<p>\u5b9e\u73b0:Java\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre name=\"code\" class=\"java\">\nString cmd=\"cmd.exe ping \";\nString ipprefix=\"192.168.10.\";\nint begin=101;\nint end=200;\nProcess p=null;\n\nfor(int i=begin;i<end p=\"Runtime.getRuntime().exec(cmd+i);\" string line=\"null;\" bufferedreader reader=\"new\" inputstreamreader while reader.readline null may logs it. reader.close p.destroy><\/end><\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u8fd0\u884c\u5f97\u5f88\u597d,\u95ee\u9898\u662f\u4e3a\u4e86\u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801,\u4f60\u8fd8\u9700\u8981\u505a\u4e00\u4e9b\u989d\u5916\u7684\u5de5\u4f5c.\u8fd9\u4e9b\u989d\u5916\u7684\u5de5\u4f5c\u5305\u62ec:<\/p>\n<pre><code>* \u7f16\u5199\u4e00\u4e2a\u7c7b\u6587\u4ef6\n* \u7f16\u5199\u4e00\u4e2amain\u65b9\u6cd5\n* \u5c06\u4e4b\u7f16\u8bd1\u6210\u5b57\u8282\u4ee3\u7801\n* \u7531\u4e8e\u5b57\u8282\u4ee3\u7801\u4e0d\u80fd\u76f4\u63a5\u8fd0\u884c,\u4f60\u9700\u8981\u518d\u5199\u4e2a\u5c0f\u5c0f\u7684bat\u6216\u8005bash\u811a\u672c\u6765\u8fd0\u884c.<\/code><\/pre>\n<p>\u5f53\u7136,\u7528C\/C++\u540c\u6837\u80fd\u5b8c\u6210\u8fd9\u9879\u5de5\u4f5c.\u4f46C\/C++\u4e0d\u662f\u8de8\u5e73\u53f0\u8bed\u8a00.\u5728\u8fd9\u4e2a\u8db3\u591f\u7b80\u5355\u7684\u4f8b\u5b50\u4e2d\u4e5f\u8bb8\u770b\u4e0d\u51faC\/C++\u548cJava\u5b9e\u73b0\u7684\u533a\u522b,\u4f46\u5728\u4e00\u4e9b\u66f4\u4e3a\u590d\u6742\u7684\u573a\u666f,\u6bd4\u5982\u8981\u5c06\u8fde\u901a\u4e0e\u5426\u7684\u4fe1\u606f\u8bb0\u5f55\u5230\u7f51\u7edc\u6570\u636e\u5e93.\u7531\u4e8eLinux\u548cWindows\u7684\u7f51\u7edc\u63a5\u53e3\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u540c,\u4f60\u4e0d\u5f97\u4e0d\u5199\u4e24\u4e2a\u51fd\u6570\u7684\u7248\u672c.\u7528Java\u5c31\u6ca1\u6709\u8fd9\u6837\u7684\u987e\u8651.<\/p>\n<p>\u540c\u6837\u7684\u5de5\u4f5c\u7528Python\u5b9e\u73b0\u5982\u4e0b:<\/p>\n<pre name=\"code\" class=\"java\">\nimport subprocess\n\ncmd=\"cmd.exe\"\nbegin=101\nend=200\nwhile begin<end: p=\"subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,\" stdin=\"subprocess.PIPE,\" stderr=\"subprocess.PIPE)\" p.stdin.write p.stdin.close p.wait print result:><\/end:><\/pre>\n<p>\u5bf9\u6bd4Java,Python\u7684\u5b9e\u73b0\u66f4\u4e3a\u7b80\u6d01,\u4f60\u7f16\u5199\u7684\u65f6\u95f4\u66f4\u5feb.\u4f60\u4e0d\u9700\u8981\u5199main\u51fd\u6570,\u5e76\u4e14\u8fd9\u4e2a\u7a0b\u5e8f\u4fdd\u5b58\u4e4b\u540e\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c.\u53e6\u5916,\u548cJava\u4e00\u6837,Python\u4e5f\u662f\u8de8\u5e73\u53f0\u7684.<\/p>\n<p>\u6709\u7ecf\u9a8c\u7684C\/Java\u7a0b\u5e8f\u5458\u53ef\u80fd\u4f1a\u4e89\u8bba\u8bf4\u7528C\/Java\u5199\u4f1a\u6bd4Python\u5199\u5f97\u5feb.\u8fd9\u4e2a\u89c2\u70b9\u89c1\u4ec1\u89c1\u667a.\u6211\u7684\u60f3\u6cd5\u662f\u5f53\u4f60\u540c\u65f6\u638c\u63e1Java\u548cPython\u4e4b\u540e,\u4f60\u4f1a\u53d1\u73b0\u7528Python\u5199\u8fd9\u7c7b\u7a0b\u5e8f\u7684\u901f\u5ea6\u4f1a\u6bd4Java\u5feb\u4e0a\u8bb8\u591a.\u4f8b\u5982\u64cd\u4f5c\u672c\u5730\u6587\u4ef6\u65f6\u4f60\u4ec5\u9700\u8981\u4e00\u884c\u4ee3\u7801\u800c\u4e0d\u9700\u8981Java\u7684\u8bb8\u591a\u6d41\u5305\u88c5\u7c7b.\u5404\u79cd\u8bed\u8a00\u6709\u5176\u5929\u7136\u7684\u9002\u5408\u7684\u5e94\u7528\u8303\u56f4.\u7528Python\u5904\u7406\u4e00\u4e9b\u7b80\u77ed\u7a0b\u5e8f\u7c7b\u4f3c\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7684\u4ea4\u4e92\u7f16\u7a0b\u5de5\u4f5c\u6700\u7701\u65f6\u7701\u529b.<\/p>\n<p>Python\u5e94\u7528\u573a\u5408\n\u8db3\u591f\u7b80\u5355\u7684\u4efb\u52a1,\u4f8b\u5982\u4e00\u4e9bshell\u7f16\u7a0b.\u5982\u679c\u4f60\u559c\u6b22\u7528Python\u8bbe\u8ba1\u5927\u578b\u5546\u4e1a\u7f51\u7ad9\u6216\u8005\u8bbe\u8ba1\u590d\u6742\u7684\u6e38\u620f,\u6089\u542c\u5c0a\u4fbf.<\/p>\n<p>2 \u5feb\u901f\u5165\u95e8\n2.1 Hello world\n\u5b89\u88c5\u5b8cPython\u4e4b\u540e(\u6211\u672c\u673a\u7684\u7248\u672c\u662f2.5.4),\u6253\u5f00IDLE(Python GUI) , \u8be5\u7a0b\u5e8f\u662fPython\u8bed\u8a00\u89e3\u91ca\u5668,\u4f60\u5199\u7684\u8bed\u53e5\u80fd\u591f\u7acb\u5373\u8fd0\u884c.\u6211\u4eec\u5199\u4e0b\u4e00\u53e5\u8457\u540d\u7684\u7a0b\u5e8f\u8bed\u53e5:<\/p>\n<pre name=\"code\" class=\"java\">\nprint \"Hello,world!\"\n<\/pre>\n<p>\u5e76\u6309\u56de\u8f66.\u4f60\u5c31\u80fd\u770b\u5230\u8fd9\u53e5\u88abK&#038;R\u5f15\u5165\u5230\u7a0b\u5e8f\u4e16\u754c\u7684\u540d\u8a00.<\/p>\n<p>\u5728\u89e3\u91ca\u5668\u4e2d\u9009\u62e9&#8221;File&#8221;&#8211;&#8220;New Window&#8221; \u6216\u5feb\u6377\u952e Ctrl+N , \u6253\u5f00\u4e00\u4e2a\u65b0\u7684\u7f16\u8f91\u5668.\u5199\u4e0b\u5982\u4e0b\u8bed\u53e5:<\/p>\n<pre name=\"code\" class=\"java\">\nprint \"Hello,world!\"\nraw_input(\"Press enter key to close this window\");\n<\/pre>\n<p>\u4fdd\u5b58\u4e3aa.py\u6587\u4ef6.\u6309F5,\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u7a0b\u5e8f\u7684\u8fd0\u884c\u7ed3\u679c\u4e86.\u8fd9\u662fPython\u7684\u7b2c\u4e8c\u79cd\u8fd0\u884c\u65b9\u5f0f.<\/p>\n<p>\u627e\u5230\u4f60\u4fdd\u5b58\u7684a.py\u6587\u4ef6,\u53cc\u51fb.\u4e5f\u53ef\u4ee5\u770b\u5230\u7a0b\u5e8f\u7ed3\u679c.Python\u7684\u7a0b\u5e8f\u80fd\u591f\u76f4\u63a5\u8fd0\u884c,\u5bf9\u6bd4Java,\u8fd9\u662f\u4e00\u4e2a\u4f18\u52bf.<\/p>\n<p>2.2 \u56fd\u9645\u5316\u652f\u6301\n\u6211\u4eec\u6362\u4e00\u79cd\u65b9\u5f0f\u6765\u95ee\u5019\u4e16\u754c.\u65b0\u5efa\u4e00\u4e2a\u7f16\u8f91\u5668\u5e76\u5199\u5982\u4e0b\u4ee3\u7801:<\/p>\n<pre name=\"code\" class=\"java\">\nprint \"\u6b22\u8fce\u6765\u5230\u5965\u8fd0\u4e2d\u56fd!\"\nraw_input(\"Press enter key to close this window\");\n<\/pre>\n<p>\u5728\u4f60\u4fdd\u5b58\u4ee3\u7801\u7684\u65f6\u5019,Python\u4f1a\u63d0\u793a\u4f60\u662f\u5426\u6539\u53d8\u6587\u4ef6\u7684\u5b57\u7b26\u96c6,\u7ed3\u679c\u5982\u4e0b:<\/p>\n<pre name=\"code\" class=\"java\">\n# -*- coding: cp936 -*-\n\nprint \"\u6b22\u8fce\u6765\u5230\u5965\u8fd0\u4e2d\u56fd!\"\nraw_input(\"Press enter key to close this window\");\n<\/pre>\n<p>\u5c06\u8be5\u5b57\u7b26\u96c6\u6539\u4e3a\u6211\u4eec\u66f4\u719f\u6089\u7684\u5f62\u5f0f:<\/p>\n<pre name=\"code\" class=\"java\">\n# -*- coding: GBK -*-\n\nprint \"\u6b22\u8fce\u6765\u5230\u5965\u8fd0\u4e2d\u56fd!\" # \u4f7f\u7528\u4e2d\u6587\u7684\u4f8b\u5b50\nraw_input(\"Press enter key to close this window\");\n<\/pre>\n<p>\u7a0b\u5e8f\u4e00\u6837\u8fd0\u884c\u826f\u597d.\n2.3 \u65b9\u4fbf\u6613\u7528\u7684\u8ba1\u7b97\u5668\n\u7528\u5fae\u8f6f\u9644\u5e26\u7684\u8ba1\u7b97\u5668\u6765\u8ba1\u6570\u5b9e\u5728\u592a\u9ebb\u70e6\u4e86.\u6253\u5f00Python\u89e3\u91ca\u5668,\u76f4\u63a5\u8fdb\u884c\u8ba1\u7b97:<\/p>\n<pre name=\"code\" class=\"java\">\na=100.0\nb=201.1\nc=2343\nprint (a+b+c)\/c\n<\/pre>\n<p>2.4 \u5b57\u7b26\u4e32,ASCII\u548cUNICODE<\/p>\n<p>\u53ef\u4ee5\u5982\u4e0b\u6253\u5370\u51fa\u9884\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f\u7684\u5b57\u7b26\u4e32:<\/p>\n<pre name=\"code\" class=\"java\">\nprint \"\"\"\nUsage: thingy [OPTIONS]\n-h Display this usage message\n-H hostname Hostname to connect to\n\"\"\"\n<\/pre>\n<p>\u5b57\u7b26\u4e32\u662f\u600e\u4e48\u8bbf\u95ee\u7684?\u8bf7\u770b\u8fd9\u4e2a\u4f8b\u5b50:<\/p>\n<pre name=\"code\" class=\"java\">\nword=\"abcdefg\"\na=word[2]\nprint \"a is: \"+a\nb=word[1:3]\nprint \"b is: \"+b # index 1 and 2 elements of word.\nc=word[:2]\nprint \"c is: \"+c # index 0 and 1 elements of word.\nd=word[0:]\nprint \"d is: \"+d # All elements of word.\ne=word[:2]+word[2:]\nprint \"e is: \"+e # All elements of word.\nf=word[-1]\nprint \"f is: \"+f # The last elements of word.\ng=word[-4:-2]\nprint \"g is: \"+g # index 3 and 4 elements of word.\nh=word[-2:]\nprint \"h is: \"+h # The last two elements.\ni=word[:-2]\nprint \"i is: \"+i # Everything except the last two characters\nl=len(word)\nprint \"Length of word is: \"+ str(l)\n<\/pre>\n<p>\u8bf7\u6ce8\u610fASCII\u548cUNICODE\u5b57\u7b26\u4e32\u7684\u533a\u522b:<\/p>\n<pre name=\"code\" class=\"java\">\nprint \"Input your Chinese name:\"\ns=raw_input(\"Press enter to be continued\");\nprint \"Your name is : \" +s;\nl=len(s)\nprint \"Length of your Chinese name in asc codes is:\"+str(l);\na=unicode(s,\"GBK\")\nl=len(a)\nprint \"I'm sorry we should use unicode char!Characters number of your Chinese \\\nname in unicode is:\"+str(l);\n<\/pre>\n<p>2.5 \u4f7f\u7528List\n\u7c7b\u4f3cJava\u91cc\u7684List,\u8fd9\u662f\u4e00\u79cd\u65b9\u4fbf\u6613\u7528\u7684\u6570\u636e\u7c7b\u578b:<\/p>\n<pre name=\"code\" class=\"java\">\nword=['a','b','c','d','e','f','g']\na=word[2]\nprint \"a is: \"+a\nb=word[1:3]\nprint \"b is: \"\nprint b # index 1 and 2 elements of word.\nc=word[:2]\nprint \"c is: \"\nprint c # index 0 and 1 elements of word.\nd=word[0:]\nprint \"d is: \"\nprint d # All elements of word.\ne=word[:2]+word[2:]\nprint \"e is: \"\nprint e # All elements of word.\nf=word[-1]\nprint \"f is: \"\nprint f # The last elements of word.\ng=word[-4:-2]\nprint \"g is: \"\nprint g # index 3 and 4 elements of word.\nh=word[-2:]\nprint \"h is: \"\nprint h # The last two elements.\ni=word[:-2]\nprint \"i is: \"\nprint i # Everything except the last two characters\nl=len(word)\nprint \"Length of word is: \"+ str(l)\nprint \"Adds new element\"\nword.append('h')\nprint word\n<\/pre>\n<p>2.6 \u6761\u4ef6\u548c\u5faa\u73af\u8bed\u53e5<\/p>\n<pre name=\"code\" class=\"java\">\n# Multi-way decision\nx=int(raw_input(\"Please enter an integer:\"))\nif x<\/pre>\n<p>2.7 \u5982\u4f55\u5b9a\u4e49\u51fd\u6570<\/p>\n<pre name=\"code\" class=\"java\">\n# Define and invoke function.\ndef sum(a,b):\nreturn a+b\n\nfunc = sum\nr = func(5,6)\nprint r\n\n# Defines function with default argument\ndef add(a,b=2):\nreturn a+b\nr=add(1)\nprint r\nr=add(1,5)\nprint r\n<\/pre>\n<p>\u5e76\u4e14,\u4ecb\u7ecd\u4e00\u4e2a\u65b9\u4fbf\u597d\u7528\u7684\u51fd\u6570:<\/p>\n<pre name=\"code\" class=\"java\">\n# The range() function\na =range(5,10)\nprint a\na = range(-2,-7)\nprint a\na = range(-7,-2)\nprint a\na = range(-2,-11,-3) # The 3rd parameter stands for step\nprint a\n<\/pre>\n<p>2.8 \u6587\u4ef6I\/O<\/p>\n<pre name=\"code\" class=\"java\">\nspath=\"D:\/download\/baa.txt\"\nf=open(spath,\"w\") # Opens file for writing.Creates this file doesn't exist.\nf.write(\"First line 1.\\n\")\nf.writelines(\"First line 2.\")\n\nf.close()\n\nf=open(spath,\"r\") # Opens file for reading\n\nfor line in f:\nprint line\n\nf.close()\n<\/pre>\n<p>2.9 \u5f02\u5e38\u5904\u7406<\/p>\n<pre name=\"code\" class=\"java\">\ns=raw_input(\"Input your age:\")\nif s ==\"\":\nraise Exception(\"Input must no be empty.\")\n\ntry:\ni=int(s)\nexcept ValueError:\nprint \"Could not convert data to an integer.\"\nexcept:\nprint \"Unknown exception!\"\nelse: # It is useful for code that must be executed if the try clause does not raise an exception\nprint \"You are %d\" % i,\" years old\"\nfinally: # Clean up action\nprint \"Goodbye!\"\n<\/pre>\n<p>2.10 \u7c7b\u548c\u7ee7\u627f<\/p>\n<pre name=\"code\" class=\"java\">\nclass Base:\ndef __init__(self):\nself.data = []\ndef add(self, x):\nself.data.append(x)\ndef addtwice(self, x):\nself.add(x)\nself.add(x)\n\n# Child extends Base\nclass Child(Base):\ndef plus(self,a,b):\nreturn a+b\n\noChild =Child()\noChild.add(\"str1\")\nprint oChild.data\nprint oChild.plus(2,3)\n<\/pre>\n<p>2.11 \u5305\u673a\u5236\n\u6bcf\u4e00\u4e2a.py\u6587\u4ef6\u79f0\u4e3a\u4e00\u4e2amodule,module\u4e4b\u95f4\u53ef\u4ee5\u4e92\u76f8\u5bfc\u5165.\u8bf7\u53c2\u770b\u4ee5\u4e0b\u4f8b\u5b50:<\/p>\n<pre name=\"code\" class=\"java\">\n# a.py\ndef add_func(a,b):\nreturn a+b\n<\/pre>\n<pre name=\"code\" class=\"java\">\n# b.py\nfrom a import add_func # Also can be : import a\n\nprint \"Import add_func from module a\"\nprint \"Result of 1 plus 2 is: \"\nprint add_func(1,2) # If using \"import a\" , then here should be \"a.add_func\"\n<\/pre>\n<p>module\u53ef\u4ee5\u5b9a\u4e49\u5728\u5305\u91cc\u9762.Python\u5b9a\u4e49\u5305\u7684\u65b9\u5f0f\u7a0d\u5fae\u6709\u70b9\u53e4\u602a,\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2aparent\u6587\u4ef6\u5939,\u8be5\u6587\u4ef6\u5939\u6709\u4e00\u4e2achild\u5b50\u6587\u4ef6\u5939.child\u4e2d\u6709\u4e00\u4e2amodule a.py . \u5982\u4f55\u8ba9Python\u77e5\u9053\u8fd9\u4e2a\u6587\u4ef6\u5c42\u6b21\u7ed3\u6784?\u5f88\u7b80\u5355,\u6bcf\u4e2a\u76ee\u5f55\u90fd\u653e\u4e00\u4e2a\u540d\u4e3a<em>init<\/em>.py \u7684\u6587\u4ef6.\u8be5\u6587\u4ef6\u5185\u5bb9\u53ef\u4ee5\u4e3a\u7a7a.\u8fd9\u4e2a\u5c42\u6b21\u7ed3\u6784\u5982\u4e0b\u6240\u793a:\nparent\n&#8211;_<em>init<\/em>.py\n&#8211;child\n&#8212; _<em>init<\/em>.py\n&#8211;a.py<\/p>\n<p>b.py<\/p>\n<p>\u90a3\u4e48Python\u5982\u4f55\u627e\u5230\u6211\u4eec\u5b9a\u4e49\u7684module?\u5728\u6807\u51c6\u5305sys\u4e2d,path\u5c5e\u6027\u8bb0\u5f55\u4e86Python\u7684\u5305\u8def\u5f84.\u4f60\u53ef\u4ee5\u5c06\u4e4b\u6253\u5370\u51fa\u6765:<\/p>\n<pre name=\"code\" class=\"java\">\nimport sys\n\nprint sys.path\n<\/pre>\n<p>\u901a\u5e38\u6211\u4eec\u53ef\u4ee5\u5c06module\u7684\u5305\u8def\u5f84\u653e\u5230\u73af\u5883\u53d8\u91cfPYTHONPATH\u4e2d,\u8be5\u73af\u5883\u53d8\u91cf\u4f1a\u81ea\u52a8\u6dfb\u52a0\u5230sys.path\u5c5e\u6027.\u53e6\u4e00\u79cd\u65b9\u4fbf\u7684\u65b9\u6cd5\u662f\u7f16\u7a0b\u4e2d\u76f4\u63a5\u6307\u5b9a\u6211\u4eec\u7684module\u8def\u5f84\u5230sys.path \u4e2d:<\/p>\n<pre name=\"code\" class=\"java\">\nimport sys\nsys.path.append('D:\\\\download')\n\nfrom parent.child.a import add_func\n\nprint sys.path\n\nprint \"Import add_func from module a\"\nprint \"Result of 1 plus 2 is: \"\nprint add_func(1,2)\n\n<\/pre>\n<p>\u603b\u7ed3\n\u4f60\u4f1a\u53d1\u73b0\u8fd9\u4e2a\u6559\u7a0b\u76f8\u5f53\u7684\u7b80\u5355.\u8bb8\u591aPython\u7279\u6027\u5728\u4ee3\u7801\u4e2d\u4ee5\u9690\u542b\u65b9\u5f0f\u63d0\u51fa,\u8fd9\u4e9b\u7279\u6027\u5305\u62ec:Python\u4e0d\u9700\u8981\u663e\u5f0f\u58f0\u660e\u6570\u636e\u7c7b\u578b,\u5173\u952e\u5b57\u8bf4\u660e,\u5b57\u7b26\u4e32\u51fd\u6570\u7684\u89e3\u91ca\u7b49\u7b49.\u6211\u8ba4\u4e3a\u4e00\u4e2a\u719f\u7ec3\u7684\u7a0b\u5e8f\u5458\u5e94\u8be5\u5bf9\u8fd9\u4e9b\u6982\u5ff5\u76f8\u5f53\u4e86\u89e3,\u8fd9\u6837\u5728\u4f60\u6324\u51fa\u5b9d\u8d35\u7684\u4e00\u5c0f\u65f6\u9605\u8bfb\u8fd9\u7bc7\u77ed\u77ed\u7684\u6559\u7a0b\u4e4b\u540e,\u4f60\u80fd\u591f\u901a\u8fc7\u5df2\u6709\u77e5\u8bc6\u7684\u8fc1\u79fb\u7c7b\u6bd4\u5c3d\u5feb\u719f\u6089 Python,\u7136\u540e\u5c3d\u5feb\u80fd\u7528\u5b83\u5f00\u59cb\u7f16\u7a0b.<\/p>\n<p>\u5f53\u7136,1\u5c0f\u65f6\u5b66\u4f1aPython\u9887\u6709\u54d7\u4f17\u53d6\u5ba0\u4e4b\u5acc.\u786e\u5207\u7684\u8bf4,\u7f16\u7a0b\u8bed\u8a00\u5305\u62ec\u8bed\u6cd5\u548c\u6807\u51c6\u5e93.\u8bed\u6cd5\u76f8\u5f53\u4e8e\u6b66\u672f\u62db\u5f0f,\u800c\u6807\u51c6\u5e93\u5e94\u7528\u5b9e\u8df5\u7ecf\u9a8c\u5219\u7c7b\u4f3c\u4e8e\u5185\u529f,\u9700\u8981\u957f\u671f\u953b\u70bc.Python\u5b66\u4e60\u4e86Java\u7684\u957f\u5904,\u63d0\u4f9b\u4e86\u5927\u91cf\u6781\u65b9\u4fbf\u6613\u7528\u7684\u6807\u51c6\u5e93\u4f9b\u7a0b\u5e8f\u5458&#8221;\u62ff\u6765\u4e3b\u4e49&#8221;.(\u8fd9\u4e5f\u662fPython\u6210\u529f\u7684\u539f\u56e0),\u5728\u5f00\u7bc7\u6211\u4eec\u770b\u5230\u4e86 Python\u5982\u4f55\u8c03\u7528Windows cmd\u7684\u4f8b\u5b50,\u4ee5\u540e\u6211\u4f1a\u5c3d\u91cf\u5199\u4e0a\u5404\u6807\u51c6\u5e93\u7684\u7528\u6cd5\u548c\u4e00\u4e9b\u5e94\u7528\u6280\u5de7,\u8ba9\u5927\u5bb6\u771f\u6b63\u638c\u63e1Python.<\/p>\n<p>\u4f46\u4e0d\u7ba1\u600e\u6837,\u81f3\u5c11\u4f60\u73b0\u5728\u4f1a\u7528Python\u4ee3\u66ff\u7e41\u7410\u7684\u6279\u5904\u7406\u5199\u7a0b\u5e8f\u4e86.\u5e0c\u671b\u90a3\u4e9b\u771f\u7684\u80fd\u5728\u4e00\u5c0f\u65f6\u5185\u8bfb\u5b8c\u672c\u6587\u5e76\u5f00\u59cb\u4f7f\u7528Python\u7684\u7a0b\u5e8f\u5458\u4f1a\u559c\u6b22\u8fd9\u7bc7\u5c0f\u6587\u7ae0,\u8c22\u8c22!<\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u4f7f\u7528Python \u5047\u8bbe\u6211\u4eec\u6709\u8fd9\u4e48\u4e00\u9879\u4efb\u52a1:\u7b80\u5355\u6d4b\u8bd5\u5c40\u57df\u7f51\u4e2d\u7684\u7535\u8111\u662f\u5426\u8fde\u901a.\u8fd9\u4e9b\u7535\u8111\u7684ip\u8303\u56f4\u4ece192.168.0.101\u5230192.168.0.200. \u601d\u8def:\u7528shell\u7f16\u7a0b.(Linux\u901a\u5e38\u662f&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[275,35],"class_list":["post-453","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-2","tag-35"],"_links":{"self":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=453"}],"version-history":[{"count":9,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":463,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/453\/revisions\/463"}],"wp:attachment":[{"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}