From 21545ce2c4bb99b39861467ad92c0b47029f1f22 Mon Sep 17 00:00:00 2001 From: Saul Pwanson Date: Wed, 15 May 2024 23:53:11 -0700 Subject: [PATCH] [rec] use f-strings --- visidata/loaders/rec.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/visidata/loaders/rec.py b/visidata/loaders/rec.py index f4b345866..ed4193959 100644 --- a/visidata/loaders/rec.py +++ b/visidata/loaders/rec.py @@ -128,13 +128,16 @@ def save_rec(vd, p, *vsheets): comments = getattr(vs, 'comments', []) if comments: fp.write('# ' + '\n# '.join(comments) + '\n') - fp.write('%rec: ' + vs.name + '\n') + fp.write(f'%rec: {vs.name}\n') for col in vs.visibleCols: if col.keycol: - fp.write('%key: ' + col.name + '\n') + fp.write(f'%key: {col.name}\n') for row in Progress(vs.rows): for col in vs.visibleCols: - fp.write(col.name+': '+encode_multiline(col.getDisplayValue(row))+'\n') + cell = col.getCell(row) + if cell.value is not None: + val = encode_multiline(cell.text) + fp.write(f'{col.name}: {val}\n') fp.write('\n') fp.write('\n')