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


Python Employee.id方法代码示例

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


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

示例1: line_to_employee

# 需要导入模块: from models import Employee [as 别名]
# 或者: from models.Employee import id [as 别名]
def line_to_employee(db, feed_line):
    data = {}
    
    # Every line starts with a field, then a tab
    (email_name, tail) = feed_line.split('\t')
    data['email_name'] = email_name

    # Split tail by double spaces and find any fields with data
    def keep_it(s):
        s = s.strip()
        return s != "" and s != "xxx"
    tail_items = [x.strip() for x in tail.split('  ') if keep_it(x)]

    # Try to match fields with known headers
    tail_cols = ['full_name', 'position', 'comments']
    for field,value in zip(tail_cols, tail_items):
        data[field] = value

    employee_doc = Employee(**data) 
    employee_id = insert_employee(db, employee_doc)
    employee_doc.id = employee_id
    
    return employee_doc
开发者ID:hausdorf,项目名称:vn,代码行数:25,代码来源:rolodex.py


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