import socket
try:
url = input('Enter URL: ')
host = url.split('/')[2]
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((host, 80))
cmd = 'GET ' + host + ' HTTP/1.0\n\n'
cmd = cmd.encode()
mysock.send(cmd)
In the above code where it says:
host = url.split('/')[2]
I learnt from a video that to extract the host only it is element of index 2, but what actually is element of index?