函数中包含以下内容:
edu = sorted(context.education, key=lambda studied: studied["studied_to"], reverse=True)
#print edu[0].studied_to
job_history = []
for job in context.job_history:
if edu[0].fields_of_study in job.industries:
from_ = job.from_
to_ = job.to_
industries = job.industries
rd = rdelta.relativedelta(to_, from_) # get date difference
# I suspect that combined exp calculation would be done here.
experience = "{0.years} Years {0.months} Months".format(rd) #get Year - Month format
#print experience
job_history.append({"job_title": job_title,
"company_name": company_name,
"from_": from_,
"to_": to_,
"industries": industries,
"experience": experience})
j = sorted(job_history, key=lambda s: s["to_"])
#print j[0]["job_title"]
return {"relocate_list": provinces,
"disabilities_dict": disabilities,
"industries_list": industry_dict,
"job_history_sorted": j,
"education_sorted": edu}
我可以从上面的代码每一个工作的经验。有没有办法计算出综合经验。
目前,假设用户在IT行业有/有多个工作,为了论证,上面的代码将给我例如1 Years 0 Months
和1 Years 4 Months
。你知道吗
如何计算组合经验,使上面的例子是2 Years 4 Months
?你知道吗
我试过:
rd += rd
但这加上了相同的日期,即
1 Years 4 Months + 1 Years 4 Months
将输出:
2 Years 8 Months
为什么不创建一个新变量来保存相对增量并在循环外显示它,比如:
相关问题 更多 >
编程相关推荐