當前位置: 首頁>>代碼示例>>Python>>正文


Python Database.fetch方法代碼示例

本文整理匯總了Python中data.database.Database.fetch方法的典型用法代碼示例。如果您正苦於以下問題:Python Database.fetch方法的具體用法?Python Database.fetch怎麽用?Python Database.fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在data.database.Database的用法示例。


在下文中一共展示了Database.fetch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_scores

# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_scores(scoring_method, unweighted, unstressed):
    method_mean, method_addition = SCORING_METHODS[scoring_method]

    sql = "select word, score from scores where \
        unweighted = {} and unstressed = {} \
        and method_mean = {} and method_addition = {};".format(
            unweighted, unstressed, method_mean, method_addition
        )

    return Database.fetch(sql)
開發者ID:gkufera,項目名稱:phonetic_markov,代碼行數:12,代碼來源:load_data.py

示例2: load_phonemes

# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_phonemes(unweighted, unstressed):
    next_phonemes = 'next_phonemes_unweighted' if unweighted else 'next_phonemes'
    sql = "select phoneme, {} from phonemes where unstressed = {};".format(
        next_phonemes, unstressed
    )
    results = Database.fetch(sql)

    output = {}
    for phoneme, next_phonemes in results:
        output[phoneme] = json.loads(next_phonemes)

    return output
開發者ID:gkufera,項目名稱:phonetic_markov,代碼行數:14,代碼來源:load_data.py

示例3: load_words

# 需要導入模塊: from data.database import Database [as 別名]
# 或者: from data.database.Database import fetch [as 別名]
def load_words():
    return Database.fetch("select * from words;")
開發者ID:gkufera,項目名稱:phonetic_markov,代碼行數:4,代碼來源:load_data.py


注:本文中的data.database.Database.fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。