와 목록을 통해 방법 :방법, 예를 들어, urlparse와 목록을 통해하는 urlparse
from urlparse import urlparse
class Paste(models.Model):
paste = models.TextField()
def render_url(self):
return ['{0}'.format(url) for url in self.paste.split()]
def server(self):
url_parse = urlparse(self.render_url)
return url_parse.hostname.lstrip('www.')
Example:
Paste: Result
http://www.example2.com/32/skwieq.html >> Hostname example2.com
http://www.example2.com/2/cxvxcveq.html >> Hostname example2.com
http://www.example4.com/10/skasd1ieq.html >> Hostname example4.com
http://www.example4.com/x/ooqweeq.html >> Hostname example4.com
어떤 제안이 감사해야 할 일.
당신이 "목록을"무엇을 의미합니까? – tacaswell
@tcaswell : 전치법은 어떨까요? – abarnert