Python的数据结构 -- 字符串

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

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