'School', 'School', place[0], c) ed_row['Major'] = place[2].strip() and insert( 'Major', 'Major', place[2], c) ed_row['from_month'] = place[3][ 'from_month'] if 'from_month' in place[3] else '' ed_row['from_year'] = place[3][ 'from_year'] if 'from_year' in place[3] else '' ed_row['to_month'] = place[3]['to_month'] if 'to_month' in place[ 2] else '' ed_row['to_year'] = place[3]['to_year'] if 'to_year' in place[ 3] else '' ed_row['ongoing'] = 1 if exp_row['to_year'] == 'Present' else 0 c.execute("INSERT INTO Education VALUES (NULL,?,?,?,?,?,?,?,?,?)", ed_row.values()) print get_name(objs) conn.commit() conn.close() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help="Directory with pdf files") parser.add_argument('-o', '--output', required=True) args = parser.parse_args() if not os.path.exists(args.input): exit("Please specify an existing direcory using the -i parameter.") main(args)
exp_row["to_year"] = place[2]["to_year"] if "to_year" in place[2] else "" exp_row["ongoing"] = 1 if exp_row["to_year"] == "Present" else 0 exp_row["description"] = place[3].strip() c.execute("INSERT INTO Experience VALUES (NULL,?,?,?,?,?,?,?,?,?)", exp_row.values()) for place in get_education_info(ed): for key in ed_row: if key <> "personId": ed_row[key] = "" ed_row["Degree"] = place[1].strip() and insert("Degree", "Degree", place[1], c) ed_row["School"] = place[0].strip() and insert("School", "School", place[0], c) ed_row["Major"] = place[2].strip() and insert("Major", "Major", place[2], c) ed_row["from_month"] = place[3]["from_month"] if "from_month" in place[3] else "" ed_row["from_year"] = place[3]["from_year"] if "from_year" in place[3] else "" ed_row["to_month"] = place[3]["to_month"] if "to_month" in place[2] else "" ed_row["to_year"] = place[3]["to_year"] if "to_year" in place[3] else "" ed_row["ongoing"] = 1 if exp_row["to_year"] == "Present" else 0 c.execute("INSERT INTO Education VALUES (NULL,?,?,?,?,?,?,?,?,?)", ed_row.values()) print get_name(objs) conn.commit() conn.close() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", required=True, help="Directory with pdf files") parser.add_argument("-o", "--output", required=True) args = parser.parse_args() if not os.path.exists(args.input): exit("Please specify an existing direcory using the -i parameter.") main(args)