summaryrefslogtreecommitdiffstats
path: root/read_table_colspec.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-06-26 12:19:18 +0800
committerAaron LI <aaronly.me@outlook.com>2016-06-26 12:19:18 +0800
commit9a8a504bd845a5047103dc6e538a62afd41f0cc6 (patch)
tree959f9b9ca26ade408bc343bb24159212df92a715 /read_table_colspec.py
parent8eabb89d0fb55e70be3d619a08288e051ff00367 (diff)
downloadcexcess-9a8a504bd845a5047103dc6e538a62afd41f0cc6.tar.bz2
read_table_colspec.py: allow missing data columns
Diffstat (limited to 'read_table_colspec.py')
-rwxr-xr-xread_table_colspec.py12
1 files changed, 10 insertions, 2 deletions
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