From 9ff69a54fb404c54c4576a9264780b7fdbf5cd5f Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Mon, 27 Apr 2020 14:31:47 +0200 Subject: [PATCH] api/tools: add append option to DataLog class --- pybricks/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pybricks/tools.py b/pybricks/tools.py index 6e5c20e..1ac430d 100644 --- a/pybricks/tools.py +++ b/pybricks/tools.py @@ -51,7 +51,8 @@ class StopWatch: class DataLog: """Create a file and log data.""" - def __init__(self, *headers, name='log', timestamp=True, extension='csv'): + def __init__(self, *headers, name='log', timestamp=True, extension='csv', + append=False): """ Arguments: @@ -63,6 +64,10 @@ class DataLog: file name. This way, your file has a unique name. Choose ``False`` to omit the timestamp. extension (str): File extension. + append (bool): Choose ``True`` to reopen an existing data log file + and append data to it. Choose ``False`` to clear existing + data. If the file does not exist yet, an empty file will be + created either way. """ pass