Guest User

Untitled

a guest
Jan 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. def linkify(words, urls):
  2. if isinstance(words, basestring) or not isinstance(words, (list, tuple)):
  3. if isinstance(urls, basestring) or not isinstance(urls, (list, tuple)):
  4. return linkify([words], [urls])
  5. else:
  6. return words
  7. else:
  8. html_links = ['<a href="{1}">{0}</a>'.format(word,url)
  9. for word, url in zip(words, urls)
  10. if word is not None and url is not None]
  11. return ", ".join(html_links)
Add Comment
Please, Sign In to add comment