From ee267ca165b477abe6bda3146b5a1ef9ee1d074f Mon Sep 17 00:00:00 2001 From: Adesh Gupta Date: Fri, 1 Apr 2016 22:57:44 -0700 Subject: [PATCH] Updated code to work scholar.py output with apache commons CSV libraries Updated code to work scholar.py output with apache commons CSV libraries. Also updated the help information for the same --- scholar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scholar.py b/scholar.py index 21f26aa..56fbf02 100755 --- a/scholar.py +++ b/scholar.py @@ -308,7 +308,7 @@ def as_txt(self): res.append(fmt % (item[1], item[0])) return '\n'.join(res) - def as_csv(self, header=False, sep='|'): + def as_csv(self, header=False, sep=','): # Get keys sorted in specified order: keys = [pair[0] for pair in \ sorted([(key, val[2]) for key, val in list(self.attrs.items())], @@ -1097,7 +1097,7 @@ def txt(querier, with_globals): for art in articles: print(encode(art.as_txt()) + '\n') -def csv(querier, header=False, sep='|'): +def csv(querier, header=False, sep=','): articles = querier.articles for art in articles: result = art.as_csv(header=header, sep=sep) @@ -1165,7 +1165,7 @@ def main(): group.add_option('--txt-globals', action='store_true', help='Like --txt, but first print global results too') group.add_option('--csv', action='store_true', - help='Print article data in CSV form (separator is "|")') + help='Print article data in CSV form (separator is ",")') group.add_option('--csv-header', action='store_true', help='Like --csv, but print header with column names') group.add_option('--citation', metavar='FORMAT', default=None,