cli.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:etcdb 作者: box 项目源码 文件源码
def get_query(prompt):
    """
    Get input from a user terminated by a semicolon and return a string.

    :param prompt: A prompt string.
    :type prompt: str
    :return: User input without a trailing semicolon.
    :rtype: str
    """
    readline.parse_and_bind('set editing-mode vi')
    query = ""
    while True:
        line = raw_input(prompt)
        query += "%s " % line
        if ';' in line:
            break
    user_input = query.split(';', 1)[0]
    user_input = user_input.strip(' \n\t')
    return user_input
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号