我可以通过从要存储的数组名称生成文件名来循环执行此操作吗?在python中获取数组变量
ab = array.array('B', map(operator.xor, a, b))
f1 = open('ab', 'wb')
ab.tofile(f1)
f1.close
ac = array.array('B', map(operator.xor, a, c))
f1 = open('ac', 'wb')
ac.tofile(f1)
f1.close
ad = array.array('B', map(operator.xor, a, d))
f1 = open('ad', 'wb')
ad.tofile(f1)
f1.close
ae = array.array('B', map(operator.xor, a, e))
f1 = open('ae', 'wb')
ae.tofile(f1)
f1.close
af = array.array('B', map(operator.xor, a, f))
f1 = open('af', 'wb')
af.tofile(f1)
f1.close
谢谢你的帮助!
他们是在一个字典 - 它被称为*当地人()* :) – 2010-03-10 21:34:04
@伊恩是的,但有些人不喜欢使用它,因为它是一种黑客。 – 2010-03-10 21:50:21
谢谢!如果a,b,c,d,e,f也是数组,那么这样做吗? – lclevy 2010-03-10 21:53:31