From 88e72aeb0aa263c66a890e86c88f7a867bb18163 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Mon, 11 Feb 2013 12:40:52 +0000 Subject: [PATCH] tools/ucd.py: support printing out the data as CSV with specified columns from the command-line --- tools/ucd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/ucd.py b/tools/ucd.py index 1ce1f7b3..0b6847fd 100755 --- a/tools/ucd.py +++ b/tools/ucd.py @@ -182,5 +182,12 @@ def parse_ucd_data(ucd_rootdir, dataset): yield data if __name__ == '__main__': + try: + items = sys.argv[3].split(',') + except: + items = None for entry in parse_ucd_data(sys.argv[1], sys.argv[2]): - print entry + if items: + print ','.join([str(entry[item]) for item in items]) + else: + print entry