From 5d32b516af7993590ffc1a266f06c6a80bcb0b3c Mon Sep 17 00:00:00 2001 From: Willem Renes Date: Wed, 16 Jun 2021 11:58:40 +0200 Subject: adding initial code --- booklist.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 booklist.py diff --git a/booklist.py b/booklist.py new file mode 100644 index 0000000..c210a23 --- /dev/null +++ b/booklist.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +""" +Parsing/managing a book wishlist. + + - parse list + - store list + - get extra info (isbn &c) + - group by author + - intelligent detection of author misspelling/title misspelling + - online matches? goodreads? + +""" + +import sys + + +def read_booklist(file="booklist.txt"): + try: + with open(file) as f: + for line in f: + print(line) + except OSError as exc: + tb = sys.exc_info()[-1] + lineno = tb.tb_lineno + filename = tb.tb_frame.f_code.co_filename + print(f'{exc.strerror} at {filename} line {lineno}.') + sys.exit(exc.errno) + + +def main(): + """ main function, do stuff """ + read_booklist("booklist.txt") + + +if __name__ == '__main__': + main() -- cgit v1.2.3-70-g09d2