From 9a8a504bd845a5047103dc6e538a62afd41f0cc6 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 26 Jun 2016 12:19:18 +0800 Subject: read_table_colspec.py: allow missing data columns --- read_table_colspec.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'read_table_colspec.py') diff --git a/read_table_colspec.py b/read_table_colspec.py index f49026e..d627f58 100755 --- a/read_table_colspec.py +++ b/read_table_colspec.py @@ -2,7 +2,11 @@ # # Weitian LI # Created: 2016-06-25 -# Updated: 2016-06-25 +# Updated: 2016-06-26 +# +# Change logs: +# 2016-06-26: +# * Allow missing data columns # """ @@ -97,7 +101,11 @@ def parse_line(line, colspec): value = line[col_begin:].strip() else: value = line[col_begin:(col_end+1)].strip() - items.append((name, t(value), comment)) + try: + value = t(value) + except ValueError: + value = None + items.append((name, value, comment)) return items -- cgit v1.2.2