You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
828 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env cached-nix-shell
#!nix-shell -i python3 -p python3
# I want to use Anki instead of Quizlet. However, Quizlet only provides a very
# limited “export” functionality, that exports something like csv, but does not
# support quoting. So it will fail if your separation character is either your
# column or row separator (e.g. if you have multiple lines in one field).
# This script takes unquoted data with separators that dont exist on the cards
# (世 for columns, 界 for rows) and exports it as a more usable csv (quoted,
# cols separated by tab, rows separated by newline).
import sys
outfile = sys.argv[1]
quizlet_output =
maybe_tsv = '"' + quizlet_output.replace("", '"\t"').replace("", '"\n"')
maybe_tsv = maybe_tsv[:-2]
with open(outfile, "w") as f: