【发布时间】:2017-03-02 01:24:52
【问题描述】:
我想用两个这样的可迭代对象调用 python for 循环:
TEMPLATE_FILE = { 'a': 'power', 'b': 'voltage', 'c': 'current' }
for (script in TEMPLATE_FILE.values()) and (files in TEMPLATE_FILE.keys()):
print 'script: ',script
print 'files: ',files
print "\n"
但这是一个语法错误,我该怎么办?
【问题讨论】:
-
这些不是条件而是可迭代的
-
有些人可能正在寻找
zip函数
标签: python python-2.7