当前位置: 首页>>代码示例>>Python>>正文


Python User.sats方法代码示例

本文整理汇总了Python中User.sats方法的典型用法代码示例。如果您正苦于以下问题:Python User.sats方法的具体用法?Python User.sats怎么用?Python User.sats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User.sats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate_database

# 需要导入模块: import User [as 别名]
# 或者: from User import sats [as 别名]
def populate_database():
    """
        Returns a list of College objects to be stored in the database
        Then they can be reconstructed by called
        colleges = db_load_colleges()
    """
    database_schools = []
    n = 0
    cols = []
    cols_with_size = get_sizes()
    while n < len(colleges_with_sat):
        c = C(colleges_with_sat[n], colleges_with_sat[n+1], colleges_with_sat[n+2], colleges_with_sat[n+3], colleges_with_sat[n+4])
        cols.append(c)
        n+=5
                
    for i in range(0, len(colleges)):
        name = colleges[i]
        if False: #db_college_exists(name):
            continue
        sats = {}
        size = 0
        tuition = 0
        address = ""
        zipcode = 0
        matched = False
        for c in cols:
            if levenshtein(c.name, name) < 3:
                matched = True
                sats['math'] = c.math_range
                sats['reading'] = c.read_range
        if not matched:
            sats = None
        for c in cols_with_size:
            #print c[0]
            if levenshtein(c[0], name) < 3:
                size = c[1]
                tuition = c[2]
                address = c[3]
                zipcode = c[4]
                #print c
                break
        college = College(name, "", i, sats, size, tuition, address, zipcode)
        #print college
        database_schools.append(college)
        #college.print_college()
        user = User()
        user.name = "Aaron"
        user.sats = {"math" : 800, "reading" : 800}

        #print college.find_location()
        #print college.get_difficulty()
    return database_schools
开发者ID:aacoppa,项目名称:inglorious-gangsters,代码行数:54,代码来源:Populator.py


注:本文中的User.sats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。