I need some help!


#1

Hey guys i was thinking to code somthing for myself that would open the links that i use on regular basis using python, but i am getting alot of problems it says that ‘open’ module is ot defined on line 8 please help:

import webbrowser

links = ["www.facebook.com", "www.google.com"]
def open_tabs(url_lists):
    for element in url_lists:
        webbrowser.open_new_tab(element)
def main():
    webbrowser.open("www.youtube.com", new=2, autoraise=False)
    time.sleep(1)
    open_tabs(links)

main()

thanks!


#2

if you take a second to look at the documentation of the open function it says:

Note that on some platforms, trying to open a filename using this function, may work and start the operating system’s associated program. However, this is neither supported nor portable.

so this doesn’t seem to be the right function to use, we don’t want to depend on something that might or in most cases might not work, its too risky

documentation can be found here:

https://docs.python.org/2/library/webbrowser.html#webbrowser.open


#3

thanks for your help!