zoukankan      html  css  js  c++  java
  • 元组

    元组(Tuple)也是一种序列类型的数据,元组和列表都能存储任何类型的数据,但是列表中的元素可变,而元组中的元素不可变,类似于字符串,但是字符串中的元素只能是字符型。概括起来元组结合了字符串不可变特性和列表可有序存储不同类型数据的特点

    元组,元素不可被修改,不能被增加或者删除

    元组创建通过()

    当元组只包含一个元素时,要在这个元素后加 , 例如:m = (10,)

    元组的方法

    In [22]: print(dir(tuple))

    ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']

  • 相关阅读:
    left join问题
    SQL索引
    数据库查询优化
    define and inline
    程序的内存分配
    __closure
    this指针
    java笔记
    Visual Studio Code(VSCODE)语言设置
    Excel 2010如何打开多个独立窗口?
  • 原文地址:https://www.cnblogs.com/roygood/p/9698868.html
Copyright © 2011-2022 走看看