Loading...
Loading...
Loading...

目录


python奇淫巧计

计算机编程 发布于:2022/9/14/16:55 875 vk python python高级 python奇淫巧计 最近编辑于2 年,8 月前 预计阅读时长:1min

定义和使用具名元组

创建具名元组

In [1]: from collections import namedtuple

In [2]: City = namedtuple('City', 'name country population coordinates')

In [3]: tokyo = City('Tokyo', 'JP', 36.933, (35.689722, 139.691667))

In [4]: tokyo
Out[4]: City(name='Tokyo', country='JP', population=36.933, coordinates=(35.689722, 139.691667))
单词数:39字符数:323

共有0条评论