Skip to content

Instantly share code, notes, and snippets.

@nelsonjchen
Created March 12, 2017 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelsonjchen/1f7c78bb0ecb9531eddbdf846a005a86 to your computer and use it in GitHub Desktop.
Save nelsonjchen/1f7c78bb0ecb9531eddbdf846a005a86 to your computer and use it in GitHub Desktop.
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