I was trying to install beautifulsoup using pip and then there was a message that asked me to update pip so i did then when i run the code with beautiful soup it gives me a syntax error here is the code:[https://i.stack.imgur.com/GxCSO.png]
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter - ')
html = urllib.request.urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, 'html.parser')
tags = soup('a')
for tag in tags:
print(tag.get('href', None))
and the error that appears on the command:
Traceback (most recent call last):
File "C:\Users\Tasnem\Desktop\py4e\Course 3\week4\urllinks.py", line 6, in <module>
from bs4 import BeautifulSoup
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\bs4\__init__.py", line 37, in <module>
from .builder import (
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\bs4\builder\__init__.py", line 9, in <module>
from bs4.element import (
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\bs4\element.py", line 12, in <module>
import soupsieve
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\soupsieve\__init__.py", line 29, in <module>
from . import css_parser as cp
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\soupsieve\css_parser.py", line 4, in <module>
from . import util
File "C:\Users\Tasnem\AppData\Local\Programs\Python\Python35\lib\site-packages\soupsieve\util.py", line 59
f"'{func.__name__}' is deprecated. {message}",
^
SyntaxError: invalid syntax