3

I have tried to do various python codes but I cannot find any that work on my PC.

def UI():
os.system('cls' if os.name == 'nt' else 'clear')
choice1=input("Pick a program: ")
if choice1=='Google':   
 ('https://www.google.com/')

That is all I have come up with

If anybody has any answers please tell me

1

2 Answers 2

2

Use os.system('start chrome') and os.system('start chrome {}'.format(site)) in Windows or os.system('google-chrome') and os.system('google-chrome {}'.format(site)) in Linux, where site is URL for the site you're looking for.

Sign up to request clarification or add additional context in comments.

Comments

1
import webbrowser

url = 'http://docs.python.org/'

# MacOS
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'

# Windows
# chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

# Linux
# chrome_path = '/usr/bin/google-chrome %s'

webbrowser.get(chrome_path).open(url)

You can call get() with the path to Chrome. Below is an example - replace chrome_path with the correct path for your platform.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.