I'm trying to open a specific location within an HTML file with python, but it doesn't work.
The code is
import webbrowser
url = '~\docs\index.html#api.method_name'
webbrowser.open(f'file:///{url}')
This code opens the file in the browser, but the url '~\docs\index.html'. It doesn't take me to the part location of api.method_name. But if I copy and paste the ulr in a web browser, it works.
I have already tried changing the hash sign to %23, but it didn't work either.
ulrvs.url). Please make sure you copy and paste your code so it exactly represents the problem you are having. We have no way of knowing which typos are relevant and which aren't.