diff options
| author | Willem Renes <wrenes@gmail.com> | 2021-06-16 11:58:40 +0200 |
|---|---|---|
| committer | Willem Renes <wrenes@gmail.com> | 2021-06-16 11:58:40 +0200 |
| commit | 5d32b516af7993590ffc1a266f06c6a80bcb0b3c (patch) | |
| tree | 5421e6a60a4eee53ffb7e1c80989ba070e8817f2 | |
| parent | 85754e465b9fbd49d710b1c46e1d0d5d24d77c9b (diff) | |
| download | booklist-5d32b516af7993590ffc1a266f06c6a80bcb0b3c.tar.gz booklist-5d32b516af7993590ffc1a266f06c6a80bcb0b3c.zip | |
adding initial code
| -rw-r--r-- | booklist.py | 37 |
1 files changed, 37 insertions, 0 deletions
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() |
