Reading GEDCOM files

The function gedcom.parse() reads a file, string, or file-like object and returns a gedcom.GedcomFile.

gedcom.parse(obj)

Parse and return this object, if it’s a file.

If it’s a filename, it calls parse_filename(), for file-like objects, parse_fp, for strings, calls parse_string.

Parameters:obj – filename, open file-like object or string contents of GEDCOM file
Returns:GedcomFile

Writing GEDCOM files

gedcom.GedcomFile.save() saves a gedcom.GedcomFile to a specified filename, or file-like object.

GedcomFile.save(fileout)

Save the contents of this GEDCOM file to specified filename or file-like object.

Parameters:fileout – Filename or open file-like object to save this to.
Raises:Exception – if the filename exists