diff --git a/gedcom/__init__.py b/gedcom/__init__.py index c652829..1b20dd7 100644 --- a/gedcom/__init__.py +++ b/gedcom/__init__.py @@ -28,6 +28,7 @@ # Global imports import re +import sys class Gedcom: """Parses and manipulates GEDCOM 5.5 format data @@ -292,11 +293,12 @@ def get_family_members(self, family, mem_type="ALL"): # Other methods - def print_gedcom(self): - """Write GEDCOM data to stdout.""" + def print_gedcom(self, file=sys.stdout, flush=False): + """Write GEDCOM data to stream (default is sys.stdout). + argument (default is False) as the same semantics than + in the print function. """ for element in self.element_list(): - print(element) - + print(element, file=file, flush=flush) class GedcomParseError(Exception): """ Exception raised when a Gedcom parsing error occurs