【发布时间】:2009-04-16 15:02:38
【问题描述】:
最好的分割方法是什么:
tuple = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
进入这个:
tuples = [('a', 'b'), ('c', 'd'), ('e', 'f'), ('g', 'h')]
假设输入总是有偶数个值。
【问题讨论】:
-
你可能不想要一个名为 tuple 的变量,因为它会覆盖内置函数 tuple()。
标签: python data-structures tuples