def fetch():
out_path = os.path.dirname(__file__)
out_path = os.path.join(out_path, 'fingerprints', 'data', 'types.yml')
fh = urllib.urlopen(CSV_URL)
types = {}
for row in unicodecsv.DictReader(fh):
name = stringify(row.get('Name'))
abbr = stringify(row.get('Abbreviation'))
if name is None or abbr is None:
continue
if name in types and types[name] != abbr:
print name, types[name], abbr
types[name] = abbr
# print abbr, name
with open(out_path, 'w') as fh:
yaml.safe_dump({'types': types}, fh,
indent=2,
allow_unicode=True,
canonical=False,
default_flow_style=False)
评论列表
文章目录