5.3 Python中的列表配對和枚舉

        zip能夠將兩個列表配對:python >>> x = [1, 2, 3] >>> y = [4, 5, 6] >>> zipped = zip(x, y) >>> zipped [(1, 4), (2, 5), (3, 6)] >>> x2, y2 = zip(*zipped) >>> x == list(x2) and y == list(y2) True         en
相關文章
相關標籤/搜索