(Nov-17-2017, 05:58 AM)heiner55 Wrote:str = "000\n111\n222\n333\n444\n555\n" lis = str.splitlines() print(lis[3]) print(lis[5])
Output:333 555
>>> print(lis[3])
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
print(lis[3])
IndexError: list index out of range
>>> for div in soup.find_all('div', class_='results-link'):
str = ('https://globenewswire.com' + div.h1.a['href'])
lis = str.splitlines()
print(lis[7])
Traceback (most recent call last):
File "<pyshell#16>", line 4, in <module>
print(lis[7])
IndexError: list index out of range
tried that and got error both times. That is the error it sends back to me. I tried two different list values. Any idea why it may not be working? I'm on Python 3.6.3 if that makes any difference.