Open this example in the interactive library
Source code
from heapq import merge
print(list(merge([1, 4, 7], [2, 3, 9])))Sample output
[1, 2, 3, 4, 7, 9]

Open this example in the interactive library
from heapq import merge
print(list(merge([1, 4, 7], [2, 3, 9])))[1, 2, 3, 4, 7, 9]