Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- """ Usage:
- python3 dicewareGenHTML.py pathToDicewareList pathToOutputHTMLFile
- diceware list file should be a text file which looks like:
- 11111 (tabspace \t) word
- 11112 (tabspace \t) otherword
- etc...
- This program outputs an HTML page consisting in a table of all words
- which allows you to then print the said page, which makes paper sheets fulled of words (12 columns)
- and requires less pages to print the list since it compacts it (about 7 pages for the whole for my setup)
- Here is the Diceware list I used, be sure to remove the PGP signature at the top and bottom before feeding it in: http://world.std.com/%7Ereinhold/diceware.wordlist.asc
- """
- dicewareHTMLtable = open(argv[2], 'w')
- count = 0
- html = "<html>\n<body>\n<table>\n<tr>"
- for lineDiceware in open(argv[1], 'r'):
- number = lineDiceware.split("\t")[0]
- word = lineDiceware.split("\t")[1].replace("\n","")
- html += "<td>{}</td>\n".format(number)
- html += "<td>{}</td>\n".format(word)
- count += 1
- if count >= 12:
- count = 0
- html += "</tr>\n<tr>"
- html += "</tr>\n</table>\n</body>\n</html>"
- dicewareHTMLtable.write(html)
Advertisement
Add Comment
Please, Sign In to add comment