python,tuple陷阱
2017-02-07 10:54
183 查看
在python中,tuple当只有一个元素时,代码应该是如下
这是因为在python中,小括号既可以表示数学符号,也可以表示tuple,而在这种情况下,python默认表示数学符号.
`` tuple(1,)
这是因为在python中,小括号既可以表示数学符号,也可以表示tuple,而在这种情况下,python默认表示数学符号.
相关文章推荐
- Python陷阱:tuple与Nonetype
- python tuple and dict
- [python] and or 表达式陷阱一则。
- python嵌入C++------ boost.python如何在C++中调用含有不定长参数tuple变量和关键字参数dict变量的函数
- python的list,dict,tuple比较和应用
- python的list,dict,tuple比较和应用
- python的效率陷阱
- Python陷阱一则
- Python体验(03)-列表list和元组tuple
- python基础31[list+tuple+set+dict+str+file的成员方法]
- python 中参数传递 * 和 ** 的问题,以 tuple和dict方式传递参数
- Python中对Tuple之间排序时如何指定第几个元素为关键字排序的问题
- Python入门的36个例子 之 19 -> Tuple(元素组)
- python的dict,set,list,tuple应用
- python正则表达式 反斜杠(/)的麻烦和陷阱
- 开始Python -- List和Tuple(1)
- 开始Python -- List和Tuple(3)
- Python的tuple
- python-数组,序列,字典,列表,序表,元祖(tuple)
- Python组元陷阱