168
Bearbeitungen
Änderungen
update Reihenfolge aus TO auslesen
# -*- coding: utf-8 -*-
import urllib2
if application["Eingereicht"] != "":
applications_for_category.append(application)
applications_for_category.sort(key = lambda xa: xa["Titel"])
applications[category] = applications_for_category
return applications
def write_content(applications, applications_position=[]): open_position = [] open_position.extend(applications_position)
for category in applications:
f = open(category,'w+')
"Submitter (First Name)","Submitter (Last Name)"))
for a in applications[category]:
try: number = applications_position.index(a["Titel"]) + 1 open_position.remove(a["Titel"]) except ValueError: print '"' + a["Titel"] + '" im Antragsbuch nicht gefunden' number = "" writer.writerow( ( ""number,# number starts at 1
a["Titel"].encode('utf8'),
filter_content(a["Antragstext"].encode('utf8')),
f.flush()
f.close()
if open_position != []:
print "Anträge aus dem Antragsbuch, die nicht gefunden wurden: "
for a in open_position:
print a
def get_application_positions(filename):
f = open(filename,'r')
lines = [l.strip().decode('utf8') for l in f.readlines()]
return lines
if __name__ == '__main__':
content = list_content(applications)
applications = parse_content(content)
#Ein Titel per Zeile, TO-Reihenfolge gegeben #positions = get_application_positions("reihenfolge-to") write_content(applications, positions)