+#!/usr/bin/python3
'''
Created on 10.01.2024
i = 0
for kopf in export_header:
- kopf = kopf[1:-1]
+ if kopf[0] == '"':
+ kopf = kopf[1:-1]
if kopf == 'Freifeldwert_1':
sv_pn_spalte = i
if kopf == sys.argv[3]:
if len(line.rstrip()):
# not a empty line
data = line.split(";")
- delta[data[delta_pn_sp]] = data[delta_such_sp]
+ if len(data[delta_pn_sp]) == 0:
+ print("Diese Zeile hat keine Migliedsnummer: ", line)
+ else:
+ delta[int(data[delta_pn_sp])] = data[delta_such_sp]
for line in dh_export:
data = line.rstrip().split(";")
- pn = data[sv_pn_spalte][1:-1]
- if pn in delta:
- if len(delta[pn]):
- data[sv_such_spalte] = delta[pn]
- print(";".join(data), file=dh_import)
+ pn = data[sv_pn_spalte]
+ if len(pn) == 0:
+ print("Diese Zeile (export) hat keine Migliedsnummer: ", line)
+ else:
+ if pn[0] == '"':
+ pn = pn[1:-1]
+ pn = int(pn)
+ if pn in delta:
+ if len(delta[pn]):
+ if data[sv_such_spalte] != delta[pn]:
+ data[sv_such_spalte] = delta[pn]
+ print(";".join(data), file=dh_import)
+ else:
+ print(f"{pn} fehlt in delta-Datei")
dh_export.close()
dh_delta.close()