Skip to content
← Back to Community
Why is the url not opening in python?
Profile icon
Haruto121

I tried this from [stackoverflow][1] but it isn't working at repl.it
[1]: https://stackoverflow.com/questions/4302027/how-to-open-a-url-in-python
I tried it [here][2] at repl.it but the url is not opening.
[2]: https://repl.it/@Haruto121/AnimatedDarkvioletTrigger

Answered by PYer [earned 5 cycles]
View Answer
Voters
Profile icon
AbhinavD2
Profile icon
Potatoes98
Profile icon
alex_python
Profile icon
The_Potato
Profile icon
spybrave
Profile icon
Mason_tom
Profile icon
pythonmaster001
Profile icon
Haruto121
Comments
hotnewtop
Profile icon
PYer

Is this what you mean?

import webbrowser url = 'http://www.python.org/' # Open URL in a new tab, if a browser window is already open. webbrowser.open_new_tab(url + 'doc/') # Open URL in new window, raising the window if possible. webbrowser.open_new(url)
Profile icon
teymour

The webdriver module opens the url requested in a browser window. The repl.it interface can't do that. Instead you could do this: https://repl.it/@CaptainAnon/Requests-Library-Demo

Profile icon
Haruto121

@CaptainAnon Thanks but what if I want to open a site like say 'google' in the console what will I would have to do to achieve that...

Profile icon
teymour

@Haruto121 Do you just want to display the code, or render the page (so it has a search bar, etc.)?

Profile icon
Haruto121

@CaptainAnon Yeah that's what i exactly want to get the search bar and all in console

Profile icon
ash15khng

@Haruto121 I don't think that is very possible as of now in [repl.it]

Profile icon
teymour

@Haruto121 Are you trying to scrape the web with this?