Skip to content

Updated code to work scholar.py output with apache commons CSV libraries #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scholar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down