zoukankan      html  css  js  c++  java
  • 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/22 by Kerita

  • 相关阅读:
    redis安装以及php扩展
    Linux下php安装Redis扩展
    正则验证邮箱
    常用方法
    PHPExcel说明
    冒泡排序
    CURL post请求
    PHP生成随机字符串
    PHP中的字符串函数
    PHP中的数组函数
  • 原文地址:https://www.cnblogs.com/kerita/p/4447905.html
Copyright © 2011-2022 走看看