1

I am trying to use the webbrowser module but it is not working for what I would like it to do.

    import webbrowser

    key="Yes"
    key1="yes"
    key2="No"
    key3="no"

    ques1=input("Would you like us to open a website for you?")
    if ques1 == key or key1:
        webbrowser.open("http://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")
    elif ques1 == key2 or key3:
        print("We will open a website for you automatically. http://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")

1 Answers1

0

That is because you have typed the link in the print() module! This code will work:

import webbrowser
key="Yes"
key1="yes"
key2="No"
key3="no"

ques1=input("Would you like us to open a website for you?")
if ques1 == key:
        webbrowser.open("http://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")
elif ques1 == key1:
        webbrowser.open("http://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")
if ques1 == key2:
        print("We will open a website for you automatically")
        webbrowser.open("https://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")
elif ques1 == key3:
         print("We will open a website for you automatically")
         webbrowser.open("https://www.wikihow.com/Fix-the-Blue-Screen-of-Death-on-Windows")
EasyWay Coder
  • 331
  • 1
  • 7