Python Forum
How to open a list of websites
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to open a list of websites
#1
Could someone please help,

web_value.txt:
http://google.com
http://YouTube.com
openwebsites.py:

import webbrowser
import os


def websites():
    websitelist = "Setup1\\web_value.txt"
    websites = []
    browser = webbrowser.get("windows-default")
    for line in open(websitelist, "r").readlines():
        websites.append(line.strip())
    for website in websites:
        browser.open(website)
websites()
The script opens the websites in my browser and it works perfectly but it also keeps opening the directory of openwebsites.py in file explorer. Is there a way I can get the list of websites from the file and open them in the browser without opening the directory of openwebsites.py in file explorer also. I’m using VSCode


Messages In This Thread
How to open a list of websites - by Tyrel - Jul-28-2021, 09:03 PM
RE: How to open a list of websites - by Larz60+ - Aug-05-2021, 09:54 AM
RE: How to open a list of websites - by snippsat - Aug-05-2021, 01:32 PM
RE: How to open a list of websites - by buran - Aug-06-2021, 07:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is chromedriver detectable by heavy seured websites? kolarmi19 4 1,502 Mar-29-2022, 08:14 PM
Last Post: Larz60+
  How to open MIDI-file and get events in a list? philipbergwerf 7 5,028 May-29-2021, 08:24 AM
Last Post: j.crater
  how to open program file .exe from list SayHiii 2 2,451 Dec-11-2019, 01:28 AM
Last Post: SayHiii

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020