How to open a web browser from python

Postscript (2015/05/30)

New Post has a little deeper content.

Operating environment:

Insanely simple.

sample1.py


import webbrowser
url = "amazon.co.jp"
webbrowser.open(url)

However, this will open the website in IE. If you want to open your website in your favorite browser, for example chrome

sample2.py


import webbrowser
url = "amazon.co.jp"
browser = webbrowser.get('"(chrome.Absolute path to exe)" %s')
browser.open(url)

Let.

Recommended Posts

How to open a web browser from python
How to generate a Python object from JSON
[Python] How to call a c function from python (ctypes)
How to create a kubernetes pod from python code
How to write a Python class
How to access wikipedia from python
How to slice a block multiple array from a multiple array in Python
How to run a Python program from within a shell script
How to launch AWS Batch from a python client app
I made you to execute a command from a web browser
How to create a clone from Github
[Python] How to make a class iterable
[Python] How to convert a 2D list to a 1D list
How to update Google Sheets from Python
Send a message from Python to Slack
[Python] How to invert a character string
How to get a stacktrace in python
How to access RDS from Lambda (python)
How to create a repository from media
How to run a Maya Python script
How to get a string from a command line argument in python
[Python] How to get & change rows / columns / values from a table.
How to remove duplicates from a Python list while preserving order.
Send a message from Slack to a Python server
Edit Excel from Python to create a PivotTable
How to read a CSV file with Python 2/3
How to create a Python virtual environment (venv)
How to clear tuples in a list (Python)
How to install Python
How to embed a variable in a python string
How to create a function object from a string
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Study from Python Hour7: How to use classes
How to create a JSON file in Python
How to install python
[Python] How to read data from CIFAR-10 and CIFAR-100
How to get a value from a parameter store in lambda (using python)
How to add a Python module search path
Steps to develop a web application in Python
How to handle Linux commands well from Python
How to extract coefficients from a fractional formula
[Python] Flow from web scraping to data analysis
How to notify a Discord channel in Python
[Python] How to draw a histogram in Matplotlib
Extract data from a web page with Python
WEB scraping with python and try to make a word cloud from reviews
[Python] How to easily drop a child process started by multiprocess from another process
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
[Python] How to remove duplicate values from the list
How to convert / restore a string with [] in python
[Python] How to draw a line graph with Matplotlib
How to set up a Python environment using pyenv
How to scrape image data from flickr with python
(Python) Try to develop a web application using Django
[Python] How to expand variables in a character string
How to write a list / dictionary type of Python3
How to build a Django (python) environment on docker
Steps from installing Python 3 to creating a Django app
From buying a computer to running a program with python
How to make a Python package using VS Code