def main():
start = time()
count = 0
items = []
with open(TSV_FILE, 'rb') as fp:
reader = csv.reader(fp, delimiter=b'\t')
for row in reader:
name, h, entity = [v.decode('utf-8') for v in row]
s = '\\u{}'.format(h)
u = unicode_escape_decode(s)[0]
# char = '?'
log.info(u)
count += 1
items.append(ICON_TPL.format(char=u, info='U+{}'.format(h)))
if LIMIT and count == LIMIT:
break
html = PAGE_TPL.format(content='\n'.join(items), style=STYLE_TPL)
with open(HTML_FILE, 'wb') as fp:
fp.write(html.encode('utf-8'))
log.info('{:d} icons generated in {:0.2f} seconds'.format(
count, time() - start))
评论列表
文章目录