首页 > 编程语言 > 详细

python基础-2

时间:2016-03-05 20:11:58      阅读:254      评论:0      收藏:0      [点我收藏+]

一.List

 1 #coding=utf-8
 2 xx = [8, 2, 4, 5, 6]
 3 xx.append(7)
 4 print xx
 5 print xx[:3]
 6 print xx[3:]
 7 print xx.index(4)
 8 xx.insert(3, 3)
 9 print xx
10 xx.sort()
11 print xx
12 xx.remove(2)
13 print xx
14 xx.pop(2)
15 print xx
16 del(xx[1])
17 print xx

技术分享

 1 m = [1, 2, 3]
 2 n = [4, 5, 6]
 3 m += n
 4 print m
 5 m = [1, 2, 3]
 6 m.extend(n)
 7 print m
 8 letters = [a, b, c, d]
 9 print ---.join(letters)
10 print ["o"] * 5

技术分享

二.Dictionary

 

python基础-2

原文:http://www.cnblogs.com/wanderingzj/p/5245599.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!