Nov-16-2022, 03:52 PM
I'm capturing a string (url) where the array will be assembled at runtime, but I'm facing the following error ( IndexError: list index out of range ), how do I remedy this problem, below is the code:
# Native Module : urlparse -> ( https://docs.python.org/3/library/urllib.parse.html#module-urllib.parse ) from urllib.parse import urlparse url = 'https://kosmics.tech/' urco = urlparse(url) doco = urco.netloc paco = urco.path neco = doco.split('.')[0] reap = paco.split('/')[1] reco = paco.split('/')[2] reme = paco.split('/')[3] print(neco)