Created
March 12, 2017 03:04
-
-
Save nelsonjchen/1f7c78bb0ecb9531eddbdf846a005a86 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
import os | |
import yaml | |
import csv | |
with open('2.csv', 'r') as csv_file: | |
reader = csv.reader(csv_file) | |
for row in reader: | |
title = row[0] | |
description = row[1] | |
filename = row[2] | |
url = row[3] | |
thumbnail = '/assets/images/beads/%s.jpg' % filename | |
yaml_path = os.path.join('yamls', filename + '.yaml') | |
yaml_map = dict( | |
title=title, | |
thumbnail=thumbnail, | |
description=description, | |
) | |
with open(yaml_path, 'w') as yaml_file: | |
yaml.dump(yaml_map, yaml_file, default_flow_style=False) | |
print(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment