from itertools import chain a = [1, 2, 3, 4] b = ['x', 'y', 'z'] for x in chain(a, b): print(x) ''' # 使用 chain() 的一个常见场景是当你想对不同的集合中所有元素执行某些操作的时候。 # Various working sets of items active_items = set() inactive_items = set() # Iterate over all items for item in chain(active_items, inactive_items): # Process item '''