Books read in " + str(theyear) + "\n")
+ if len(booksthisyear) > 0:
+ bookindex.write("\n")
+ for book in booksthisyear:
+ if book["author"] == "":
+ bookindex.write("- " + book["title"] + "
\n")
+ else:
+ bookindex.write("- " + book["author"] + ": " + book["title"] + "
\n")
+ bookindex.write("
\n")
if workbooks > 1:
- print("+ " + str(workbooks) + " books read for work")
+ bookindex.write("
+ " + str(workbooks) + " work-related books
\n") elif workbooks == 1: - print("+ 1 book read for work") + bookindex.write("+ 1 work-related book
\n") + if len(booksthisyear) == 0 and workbooks == 0: + bookindex.write("None yet!
\n") + bookindex.write("