diff options
Diffstat (limited to 'qolab/file_utils/__init__.py')
-rw-r--r-- | qolab/file_utils/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/qolab/file_utils/__init__.py b/qolab/file_utils/__init__.py index af92c47..49c29ab 100644 --- a/qolab/file_utils/__init__.py +++ b/qolab/file_utils/__init__.py @@ -73,15 +73,15 @@ def save_table_with_header(fname, data, header='', comment_symbol='%', skip_head # itemFormat examples: 'e', '.15e', 'f' fname = filename2os_fname(fname) file_exist_flag = os.path.exists(fname) - r, c = data.shape item_format=str.join('', ['{', f':{item_format}', '}']) with open(fname, 'a') as f: if not skip_headers_if_file_exist: for l in header: f.write(f'{comment_symbol} {l}\n') - for r in data: - l=item_separator.join( map(item_format.format, r)) - f.write(l) - f.write('\n') + if data is not None: + for r in data: + l=item_separator.join( map(item_format.format, r)) + f.write(l) + f.write('\n') f.close() |