码迷,mamicode.com
首页 > 编程语言 > 详细

Python的数据结构 -- 字符串

时间:2015-04-22 17:40:59      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

zoo = (‘大象‘,‘老虎‘,‘狮子‘,‘北极熊‘)
print(‘The animal number of the is ‘, len(zoo))
print(‘The animal of the zoo are ‘,zoo)
new_zoo = (‘孔雀‘,‘鳄鱼‘,zoo)
print(‘The new animal is ‘,new_zoo)
print(‘The number of animal of the new zoo is‘,len(new_zoo))
print(‘The number 2 animal from the old zoo is‘,new_zoo[2][2])

#就是一个括号定义对象
#可以用len方法来找出对象
#可以格式化输出,而且在格式化输出的时候,如果有多个就是特别要用到元组
#还有在元组里面添加元组,就变成多维数组,特别是添加一个的时候就变二维数组,应该也是比较常用的,然后记住数组的计数是从0开始的

2015/4/19 by Kerita

Python的数据结构 -- 字符串

标签:

原文地址:http://www.cnblogs.com/kerita/p/4447920.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!