I am very new to python and dont understand why this does not work, as it shows to be working for other people.
import re
import urllib.request
#https://finance.yahoo.com/quote/
url = "https://finance.yahoo.com/quote/"
stock = input("Enter your stock: ")
url = url + stock
print(url)
https://finance.yahoo.com/quote/AAPL
data = urllib.request.urlopen(url).read()
data = urllib.request.urlopen(url).read()
data1 = data.decode("utf-8")
The error message returns:
Traceback (most recent call last): File "<pyshell#9>", line 1, in data1 = data.decode("utf-8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Please let me know how I can solve this.