Python Forum
Urls in a file to be executed - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Urls in a file to be executed (/thread-20956.html)



Urls in a file to be executed - pyseeker - Sep-08-2019

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.


RE: Urls in a file to be executed - luoheng - Sep-08-2019

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()



RE: Urls in a file to be executed - pyseeker - Sep-09-2019

@luoheng - thank you very much. It worked charmingly. Appreciate your help.