本文整理汇总了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