Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib.request
- url = "https://admin.quic.cloud/api/dnslist"
- contents = urllib.request.urlopen(url).read().decode('utf-8')
- # 得到每一行
- str_contents = contents.splitlines()
- # 用網頁上的 空白 短 空白 切割每一行
- parsing = lambda s:s.split(' - ')
- # DNS_dict: python dictionary
- # DNS名字當作 key
- # IP位置當作 value
- DNS_dict = dict( [ *map(parsing, str_contents) ] )
- print( DNS_dict )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement