Python Note - How to open URLS in txt file with webbrowser

1.Create a new .py file and save name as web.py :

import webbrowserwith open("urls.txt") as f:
for url in f:
webbrowser.open_new_tab(url)

2. Create a “urls.txt” file :

https://www.google.com/https://www.youtube.com/

3.Head to CMD and type :

python web.py

4. That’s it, and you can see the browser open the URLS in the urls.txt

Written by

Machine Learning / Deep Learning / Python / Flutter cakeresume.com/yanwei-liu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store