Launch Website URL shortcut using Python
In this article, we are going to launch favorite websites using shortcuts, for this, we will use Python’s sqlite3 and webbrowser modules to launch your favorite websites using shortcuts.
Both sqlite3 and webbrowser are a part of the python standard library, so we don’t need to install anything separately.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
The best part about this is that because we are using a database to store the websites and their shortcuts, your favorite websites will remain saved in the database even if we close the terminal or shut down the PC. So you don’t need to add your favorite websites to the database every time you execute the script.
- We create a new database if it does not already exist and connect it to our database.
- We create different functions to fetch data from the database, open a website, add a new website to the database, and remove a website from the database
- We call a while loop so that our program can listen to the user’s commands until they quit
- We ask for a response from the user to perform a specific task
Below is the implementation: