#! /usr/bin/python3 """Extract the note texts from a notes.osn file to make them printable.""" import sys def condprint(printstr): if not printstr.isspace(): print(printstr.strip().replace( """, '"').replace("newline", "\n")) with open(sys.argv[1], "rt") as file: useline = False for line in file: if useline: if '' in line: condprint(line.split('')[0]) useline = False else: condprint(line) else: if "" in line: condprint("newline" + line.split('')[1].split('')[0]) if '
' in line: condprint(line.split('
' )[1].split('
')[0]) useline = '
' not in line