小编Kir*_*lov的帖子

合并两个已排序的迭代器而不替换

我需要合并两个迭代器.我写了这个函数:

def merge_no_repeat(iter1, iter2, key=None):
    """
    a = iter([(2, 'a'), (4, 'a'), (6, 'a')])
    b = iter([(1, 'b'), (2, 'b'), (3, 'b'), (4, 'b'), (5, 'b'), (6, 'b'), (7, 'b'), (8, 'b')])
    key = lambda item: item[0]
    fusion_no_repeat(a, b, key) ->
                iter([(1, 'b'), (2, 'a'), (3, 'b'), (4, 'a'), (5, 'b'), (6, 'a'), (7, 'b'), (8, 'b')])
    :param iter1: sorted iterator
    :param iter2: sorted iterator
    :param key: lambda get sorted key, default: lambda x: x
    :return: merged iterator
    """
    if …
Run Code Online (Sandbox Code Playgroud)

python

5
推荐指数
1
解决办法
199
查看次数

Postgresql安装:找不到命令:createdb,psql

我尝试通过brew以下方式安装postgresql :

brew install postgresql@9.5
Run Code Online (Sandbox Code Playgroud)

它没有错误安装,但是控制台命令不安装(例如psql,postgresql)

我应该做一些额外的步骤吗?

postgresql macos homebrew

5
推荐指数
1
解决办法
4966
查看次数

标签 统计

homebrew ×1

macos ×1

postgresql ×1

python ×1