Wayne's Blog

  • 首页

  • 归档

  • 标签

  • 站点地图

  • 搜索

python_tutorial

发表于 2019-06-27

tuple

  1. a = (5) type(a) = 的问题

关于这个问题有相关的讨论。
一个例子是如果(3+4)*3, 结果把括号中当作tuple来看,岂不是(7,7,7),这显然不是我们想要的。

其更直接的解读是

it is the commas, not the parentheses, that define the tuple.

我们做一个测试

1
2
3
>>> a = 1,2,
>>> type(a)
<class 'tuple'>

ctypes_tutorial
当你作为non-root的Linux用户
  • 文章目录
  • 站点概览
Wayne

Wayne

21 日志
12 标签
  1. 1. tuple
© 2020 Wayne
由 Hexo 强力驱动 v3.8.0
|
主题 – NexT.Mist v7.0.1