from urllib.request import Request, urlopen
req = Request("https://pastebin.pl/view/raw/51c791c6", headers={'User-Agent': 'Mozilla/5.0'})
version = urlopen(req).read() # it's a file like object and works just like a file
print(version)
the output is
b'test'
i'm curious why the b and '' do exist. I tried to remove it by doing this
version=version.replace("b","")
but i got this error :
TypeError: a bytes-like object is required, not 'str'
i wanted to read data from a direct link then use it in the rest of the code, but i'm getting those errors . any help ?