具有兩個值I有一個字典迭代蟒字典使用For循環,並在單次迭代
Example: dict = {'one':1 ,'two':2 , 'three':3}
我想使用/的for循環單次迭代內有兩個值。最終結果應該是這樣的
# 1 2 (First iteration)
# 1 3 (Second iteration)
# 2 1
# 2 3
# 3 1
# 3 2
有人可以告訴我如何可以在Python字典中實現這一點。
for i in dict.values():
# how do i Access two values in single iteration and to have result like mentioned above
感謝
我覺得我的字典問題涉及必須有辦法 – Thomsan 2014-09-29 16:07:38
什麼是'dict.values()'區別? – 2014-09-29 16:08:14
其實我只想訪問這個值,所以我使用這個函數dict.values()例子它應該是這樣的x = 1,y = 2這些值將被用作另一個函數的參數self.funct(x, y) – Thomsan 2014-09-29 16:15:08