Created
May 22, 2014 00:36
-
-
Save lucidguppy/2c8520d8d87aef9b1d02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python3 | |
from csv import reader | |
letter_template = """ | |
<html> | |
<body> | |
<p>{0} {1}</p> | |
<p>Hi,</p> | |
<p>It was nice to meet you {0}.</p> | |
<p>Sincerely,</p> | |
<p>Mr. Dude</p> | |
</body> | |
</html> | |
""" | |
with open('names.txt', newline='') as csvfile: | |
thisreader = reader(csvfile) | |
for row in thisreader: | |
first_name = row[0] | |
second_name = row[1] | |
letter = letter_template.format(first_name, second_name) | |
with open('{}{}.html'.format(first_name,second_name), 'w') as fid: | |
fid.write(letter) |
This file contains hidden or 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
Billy | Bartofsky | |
---|---|---|
Mike | Karp | |
Joey | Baggadonuts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment