【发布时间】:2019-11-22 23:53:51
【问题描述】:
我得到了元组 -
Result = [
('80407', 'about power supply of opertional amplifier', '11 hours ago'),
('80405', '5V Regulator Power Dissipation', '11 hours ago')]
我想遍历元组并用;分隔元组中的项目。
输出应该如下-
80407;about power supply of opertional amplifier;11 hours ago
我尝试了以下方法:
for item in zip(*Result):
print(*item[0], end=';')
这给了我结果-
8 0 4 0 7;a b o u t p o w e r s u p p l y o f o p e r t i o n a l a m p l i f i e r;1 1 h o u r s a g o;
和
for item in Result:
print(*item[0], end=';')
这给了我-
8 0 4 0 7;8 0 4 0 5;
如何正确地迭代一个元组?
【问题讨论】:
标签: python python-3.x tuples iteration