首页 > 解决方案 > Bigtable python客户端:如何检索大于给定值的最小行键

问题描述

我想检索与rowkey大于给定的最小值相对应的行value

如何在 Python 中实现 Golang 客户端中存在的prefixSuccessor功能?

标签: pythongoogle-cloud-platformbigtable

解决方案


这是你想要的?您需要先调整和测试此代码。


def prefixSuccessor(text, num):

    # sort the text list
    text.sort(reverse=True)

    output = ""

    # loop through the list
    for i in range(num):
        output += text[i]

    return output


if __name__ == "__main__":

    # list of words
    text = ["ahty", "ghf", "hfy", "hfgt"]

    # find the length
    num = len(text)

    # print output
    print(prefixSuccessor(text, num))


推荐阅读