2012-11-13 29 views

回答

11

是:

tuple(zip(A, B)) 

而這一切。結果如下(在Python 2.x和3.x中都有):

>>> tuple(zip(A, B)) 
((1, 2), (3, 4), (5, 6)) 
6

你想用zip

zip((1,3,5),(2,4,6)) 

這將在技術上對python2.x和python3.x一個迭代對象返回list。爲了得到一個元組的tuple,你只圍住整個事情tuple(zip((1,3,5),(2,4,6)))