Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ged = open('Abdykerimov.ged', 'r')
- pl = open('fam.pl', 'w')
- idToPerson = {}
- cons = []
- cur = '-1'
- fname = ''
- sname = ''
- husb = ''
- wife = ''
- flag = False
- for line in ged:
- if line.find('INDI') != -1:
- if cur != '-1':
- idToPerson[cur] = [fname, sname]
- cur = line[4:9]
- if line[2:6] == 'GIVN':
- fname = line[7:len(line) - 1]
- if line[2:6] == 'SURN':
- sname = line[7:len(line) - 1]
- if line[2:4] == '@F':
- flag = True
- if line[2:6] == 'CHAN':
- flag = False
- if flag == True:
- if line[2:6] == 'HUSB':
- husb = line[9:len(line) - 2]
- if line[2:6] == 'WIFE':
- wife = line[9:len(line) - 2]
- if line[2:6] == 'CHIL':
- chil = line[9:len(line) - 2]
- cons.append([wife, husb, chil])
- idToPerson[cur] = [fname, sname]
- for x, y, z in cons:
- x = idToPerson[x]
- y = idToPerson[y]
- z = idToPerson[z]
- pl.write('parent(\'' + x[0] + ' ' + x[1] + '\',\'' + y[0] + ' ' + y[1] + '\',\'' + z[0] + ' ' + z[1] + '\')\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement