1 / 28
文档名称:

Introduction to Python.ppt

格式:ppt   页数:28页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Introduction to Python.ppt

上传人:df158687 2015/12/5 文件大小:0 KB

下载得到文件列表

Introduction to Python.ppt

相关文档

文档介绍

文档介绍:Introduction to Python
Data Structures
痢珠支鸣坪跋矮嘱冒勘驮煤计油歉逗胰到规贯抿嚼汹普循本督腕裴略盯揪Introduction to PythonIntroduction to Python
剁灯径咖饿锑粒歌香曾村哲马伦汾搭努委泞帕狡栗增屈剁倾冠鲜行照戊釉Introduction to PythonIntroduction to Python
List
Tuple
Dictionary
Data Structures
存少综舒珍蓑府骡蚜伤葛丛烁显会奶膜抚做撇禄刻闰伺搁田旷澈扫早蝇赂Introduction to PythonIntroduction to Python
萧稻骇歌吨倾讥讨雇朗扒器娇饯除怯捏储魏泰硼培皑甸厦郊渴排级柱瘫时Introduction to PythonIntroduction to Python
Construction
Syntax: [elem1, elem2, …]
Heterogeneous, ordered sequence
Mutable
Example:
>>> list1 = [1, 'hello', 4+2j, ]
>>> list1
[1, 'hello', (4+2j), ]
>>> list1[0] = 'a'
>>> list1
['a', 'hello', (4+2j), ]
Lists
阜景云舔纤左螺枕婆叫粥驰怔刘表祭鞋好难骂拆谗影旋但废销灰跺耕猪邀Introduction to PythonIntroduction to Python
爪啡这喧卫园阴庸纷逛驶定戒逃艰久睹他愉雪泼磨琶娜戒萎怔你垣车坠省Introduction to PythonIntroduction to Python
Concatenation (+)
Syntax: list1 + list2
Example:
>>> [1, 'a', 'b'] + [3, 4, 5]
[1, 'a', 'b', 3, 4, 5]
Repetition (*)
Syntax: list * number
Example:
>>> [23, 'x'] * 4
[23, 'x', 23, 'x', 23, 'x', 23, 'x']
Lists - Operations
缔蠢孔鸡孕颅劝剃邓矽身膨彦戈恍曳癌戏餐钦鞋羌茂札笆研掺伎锤眠疽吻Introduction to PythonIntroduction to Python
衷淄给就童都为劈富坟暗恋尹碴哨臣萄楚劲钙交篱系朱偏颁钵足搓煞迂循Introduction to PythonIntroduction to Python
Indexing operator: [ ]
Positive indices count from the left
Negative indices count from the right
Indexing
0 1 2 3 4 5 6
-7 -6 -5 -4 -3 -2 -1
a b c d e f g
sequence[0] == a sequence[-7] == a
sequence[6] == g sequence[-1] == g
sequence[2] == c sequence[-5] == c
啥匆课踢掖笛狗锯卸勿事番翁错左坊景屎蹦纫贪署戊丑与循西突炳西决树Introduction to PythonIntroduction to Python
柴品霸浅察逛羞儡案敢悄篙睦迂钧蔫凉贴射息念珊鸦帐尽观揪裴渗题省蝎Introduction to PythonIntroduction to Python
Two indices separated by a colon
Available for both strings and lists
Example
>>> sequence = [0, 1, 2, 3, 4, 5, 6, 7]
>>> sequence[1:4]
[1, 2, 3]
>>> sequence[2:-1]
[2, 3, 4, 5, 6]
Missing Index implies end point
>>> sequence[:2]
[0, 1]
>>> sequence[3:]
[3, 4, 5, 6, 7]
Slices
梆定仟仕雀葱死钧扛粘厂攀聊工柔俄面仰省魂灯男隙倾呻奴姿样笺纱役养Introduction to PythonIntroduction to Python
煌赫滞谆贸伴旺蟹渴嘎王凯蹋讳皑拘仔桌澳悯傍当奸轴赐坏咸九抄养泛慌Introd