Skip to content

Instantly share code, notes, and snippets.

@s7v7nislands
Created July 5, 2013 16:33
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 s7v7nislands/5935701 to your computer and use it in GitHub Desktop.
Save s7v7nislands/5935701 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
f = open("duokan.txt")
duokan = {}
for line in f:
line = line.strip()
if len(line) == 0:
continue
code, name = line.split(" ", 1)
code = "<a href='http://book.duokan.com/invite?%s'>%s</a>" % (code, code)
name = name.strip()
if name not in duokan:
duokan[name] = code
else:
duokan[name] += " # " + code
for key in duokan:
print '%s \n%s ' % (key, duokan[key])
print '***'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment