{"rsdb":{"rid":"243072","subhead":"","postdate":"0","aid":"167334","fid":"77","uid":"1","topic":"1","content":"
\n

\u4eca\u5929\u7684\u5b66\u4e60\u5185\u5bb9\u662fpython<\/a>\u4e2d\u7684\u5217\u8868\u7684\u76f8\u5173\u5185\u5bb9\u3002<\/p> \n

\u4e00.\u521b\u5efa\u5217\u8868<\/strong><\/span><\/p> \n

1.\u521b\u5efa\u4e00\u4e2a\u666e\u901a\u5217\u8868<\/strong><\/p> \n

\n
>>> tabulation1 = ['\u5927\u5723','\u5929\u84ec','\u5377\u5e18']\n>>> tabulation1\n['\u5927\u5723', '\u5929\u84ec', '\u5377\u5e18']\n<\/pre> \n <\/div> \n 
\n
>>> tabulation2 = [72,36,18]\n>>> tabulation2\n[72, 36, 18]<\/pre> \n <\/div> \n 

2.\u521b\u5efa\u4e00\u4e2a\u6df7\u5408\u5217\u8868<\/strong><\/p> \n

\n
>>> mix tabulation = ['\u5927\u5723',72,'\u5929\u84ec',36]\nSyntaxError: invalid syntax\n>>> mixtabulation = ['\u5927\u5723',72,'\u5929\u84ec',36]\n>>> mixtabulation\n['\u5927\u5723', 72, '\u5929\u84ec', 36]\n<\/pre> \n <\/div> \n 

3.\u521b\u5efa\u4e00\u4e2a\u7a7a\u5217\u8868<\/strong><\/p> \n

\n
>>> empty = []\n>>> empty\n[]\n<\/pre> \n <\/div> \n 

\u4e09\u79cd\u65b9\u5f0f\u5c31\u4ecb\u7ecd\u7ed9\u5927\u5bb6\u4e86\uff0c\u63a5\u4e0b\u6765\uff0c\u5982\u679c\u60f3\u5411\u5217\u8868\u4e2d\u6dfb\u52a0\u5143\u7d20\uff0c\u8be5\u600e\u4e48\u529e\u5462\uff1f<\/p> \n

\u4e8c.\u5411\u5217\u8868\u4e2d\u6dfb\u52a0\u5143\u7d20<\/strong><\/span><\/p> \n

1.append<\/strong><\/p> \n

\n

>>> tabulation1.append('\u7d2b\u971e')
>>> tabulation1
['\u5927\u5723', '\u5929\u84ec', '\u5377\u5e18', '\u7d2b\u971e']<\/p> \n <\/div> \n

2.extend<\/strong><\/p> \n

\n

>>> tabulation1.extend(['\u7d2b\u971e','\u9752\u971e'])
>>> tabulation1
['\u5927\u5723', '\u5929\u84ec', '\u5377\u5e18', '\u7d2b\u971e', '\u7d2b\u971e', '\u9752\u971e']<\/p> \n <\/div> \n

\u6709\u5173\u4e8e\u7528extend\u62d3\u5c55\u5217\u8868\u7684\u65b9\u6cd5\uff0c\u5927\u5bb6\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6b64\u65b9\u6cd5\u662f\u7528\u5217\u8868\u53bb\u62d3\u5c55\u5217\u8868\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u6dfb\u52a0\u5143\u7d20\uff0c\u6240\u4ee5\u201c\uff08\uff09\u201d\u4e2d\u8981\u52a0\u4e0a\u201c[]\u201d\u3002<\/p> \n

3.insert<\/strong><\/p> \n

\n
>>> tabulation1.insert(1,'\u7d2b\u971e')\n>>> tabulation1\n['\u5927\u5723', '\u7d2b\u971e', '\u5929\u84ec', '\u5377\u5e18', '\u7d2b\u971e', '\u7d2b\u971e', '\u9752\u971e']\n<\/pre> \n <\/div> \n 

\u4e0d\u60f3\u5728\u539f\u5730\u6df7\u5403\u7b49\u6b7b\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u6bcf\u5929\u8fdb\u6b65\u4e00\u70b9\u70b9\u3002<\/strong><\/p>\n<\/div>","orderid":"0","title":"python\u521b\u5efa\u5217\u8868\u548c\u5411\u5217\u8868\u6dfb\u52a0\u5143\u7d20\u65b9\u6cd5","smalltitle":"","mid":"0","fname":"Python","special_id":"0","bak_id":"0","info":"0","hits":"738","pages":"1","comments":"0","posttime":"2017-12-25 06:07:10","list":"1514153230","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"python<\/A> \u521b\u5efa<\/A> \u5411\u5217\u8868<\/A> \u6dfb\u52a0<\/A> \u5143\u7d20<\/A> \u65b9\u6cd5<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"113.110.148.213","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"python\u521b\u5efa\u5217\u8868\u548c\u5411\u5217\u8868\u6dfb\u52a0\u5143\u7d20\u65b9\u6cd5","lastview":"1714064427","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}