对gedcom文件进行格式化的正确方式是什么,因为我目前的方法并不是为了获取更多的信息,而是使用https://www.familyecho.com/?page=api生成图像。当我再加上第二个家庭时,它就不再起作用了。但对一个家庭来说很好。
Individuals = [(1, 'James', 'Smith'), (2, 'Jack', 'Smith'), (3, 'John', 'Smith'), (4, 'Jane', 'Smith'), (5, 'Jill', 'Smith')]
Families = [(1, 1, 2, 3), (2, 3, 4, 5)]
print(Individuals,Families)
with open('F.ged','w') as Gedcomfile:
for person in Individuals:
Gedcomfile.write(f"""
0 @I{person[0]}@ INDI
1 NAME {person[1]} /{person[2]}/
2 GIVN {person[1]}
2 SURN {person[2]}
""")
for family in Families:
Gedcomfile.write(f"""
0 @F{family[0]}@ FAM
1 HUSB @I{family[1]}@
1 WIFE @I{family[2]}@
1 CHIL @I{family[3]}@
""")Gedcom文件:
0 @I1@ INDI
1 NAME James /Smith/
2 GIVN James
2 SURN Smith
0 @I2@ INDI
1 NAME Jack /Smith/
2 GIVN Jack
2 SURN Smith
0 @I3@ INDI
1 NAME John /Smith/
2 GIVN John
2 SURN Smith
0 @I4@ INDI
1 NAME Jane /Smith/
2 GIVN Jane
2 SURN Smith
0 @I5@ INDI
1 NAME Jill /Smith/
2 GIVN Jill
2 SURN Smith
0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
1 CHIL @I3@
0 @F2@ FAM
1 HUSB @I3@
1 WIFE @I4@
1 CHIL @I5@发布于 2022-10-10 06:10:32
你提供了FAM记录中的丈夫、妻子和CHIL链接。但GEDCOM还需要INDI记录中的反向链接。
FAMS (S=Spouse)是丈夫和妻子的反义词。
FAMC (C=Child)与CHIL相反。
例如,在您的示例中,需要向@I3@ INDI记录添加以下两行:
1 FAMC @F1@
1 FAMS @F2@https://stackoverflow.com/questions/74002494
复制相似问题