Created
August 10, 2018 03:39
-
-
Save christinebuckler/159847d970456f94d363fa5438c8c5a6 to your computer and use it in GitHub Desktop.
create wordle image from csv text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Usage: | |
# python wordle_csv_upload.py /tmp/file.csv | |
## | |
import webbrowser | |
import sys, os | |
filename = sys.argv[1] | |
csv_file = open(filename) | |
result_file_name = "/tmp/hede.html" | |
result_file = open(result_file_name, "w") | |
html_template = """ | |
<form action="http://www.wordle.net/advanced" method="POST"> | |
<textarea name="text">%text%</textarea> | |
<input type="submit"> | |
</form> | |
""" | |
text = "" | |
for line in csv_file: | |
line = line.replace("\n", "") | |
for part in line.split(","): | |
text += " " + part | |
# print(text) | |
html_template = html_template.replace("%text%", text) | |
result_file.write(html_template) | |
result_file.close() | |
csv_file.close() | |
# webbrowser.open(result_file_name) | |
webbrowser.open('file://' + os.path.realpath(result_file_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment