Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def linkify(words, urls):
- if isinstance(words, basestring) or not isinstance(words, (list, tuple)):
- if isinstance(urls, basestring) or not isinstance(urls, (list, tuple)):
- return linkify([words], [urls])
- else:
- return words
- else:
- html_links = ['<a href="{1}">{0}</a>'.format(word,url)
- for word, url in zip(words, urls)
- if word is not None and url is not None]
- return ", ".join(html_links)
Add Comment
Please, Sign In to add comment