Python Forum

Full Version: Urls in a file to be executed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a lot of urls in a file and all the urls in that file have to be executed in a browser one by one. Can anyone suggest the best method to solve this ?

Appreciate your help.
you can use module webbrowser to open urls in default browser.
import webbrowser as wb

def main():
    urls = ["https://python-forum.io", "https://python-forum.io/Thread-Urls-in-a-file-to-be-executed"]
    for url in urls:
        wb.open(url)
main()
@luoheng - thank you very much. It worked charmingly. Appreciate your help.