Reputation: 1
My program keeps showing this error raw_input is not defined
whenever I use raw_input
:
import urllib
from bs4 import BeautifulSoup
url = raw_input('http://py4e-data.dr-chuck.net/known_by_Eqlaas.html: ')
count = int(raw_input("Enter count: "))
position = int(raw_input("Enter position:"))
for i in range(count):
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
tags = soup('a')
s = []
t = []
for tag in tags:
x = tag.get('href', None)
s.append(x)
y = tag.text
t.append(y)
print (s[position-1])
print (t[position-1])
url = s[position-1]
Upvotes: 0
Views: 519
Reputation: 3568
Since you are using python3, you have to replace
count = int(raw_input("Enter count: "))
position = int(raw_input("Enter position:"))
with
count = int(input("Enter count: "))
position = int(input("Enter position:"))
Upvotes: 1