Definition of Python Projects
Python projects are implemented in every area in which we have developed the project. Python has grown in popularity to be a widely used programming language. So acquiring the knowledge theoretical is useless unless and until we work on real-world projects. Working on such projects will put our Python skills to the test while also providing us with practical experience. While working on implementing the python project will implement our knowledge.
Introduction to Python Projects
- In today’s world, in AI and ML technologies, all of the technologies rely on Python in some way.
- Python is free and open-source. There is a thriving developer community that contributes to the technology’s advancement.
- Python is a general-purpose, interpreted programming language that is widely used in modern software development.
- Python programming is the primary focus of pure Python projects. A project allows us to group together with our libraries and personal settings into one unit.
- Python makes it easier to write portable and universal programs that can run on a variety of operating systems.
Top python projects
- Python is a very well-known programming language. Python is now used by nearly 8.2 million developers worldwide. As a result, it is recommended that we begin to gain proficiency in the Python language.
- Below is the top python projects as follows.
1. Email Slicer by using python
- Email Slicer is a simple tool that takes an email address as input and slices it to generate the username and domain.
- In the below project, we are taking the example of [email protected]. In this example abc is a username and example.com is the domain name.
Code:
py_email = input("Email is: ").strip()
Email is: [email protected]
uname = py_email[:py_email.index('@')]
py_domain = py_email [py_email.index('@') + 1:]
print (f"Username is {uname} and domain name is {py_domain}")
2. QR Code Generation by using python
- QR codes may appear simple, but they can store a large amount of data. In this project, we demonstrate how to implement a QR code generator. The below project shows to implement the QR code are as follows. In the following project, we implemented a QR code by using google.com website.
Code:
import qrcode
py_qrcode = qrcode.make ("https://www.google.com/")
py_qrcode.save ("googleQR.jpg")
- In the above project, we have installed qrcode first by using the pip command. After installing the qrcode then we are importing the same in our project by using the import keyword. Then we are making the qrcode by using qrcode.make method, we are using google.com website to make the qrcode generator. Then we are using the same method to save the generated QR code.
3. Python project of website blocker
- Aren’t we all sick of seeing random pop-ups while browsing the web? So, by creating this Python project we prevent the ads.
- As a result, the Website Blocker Python project’s goal is to prevent access to websites from any device.
- Every operating system contains a host’s file. The host file may be stored in a different location depending on the operating system. It converts the hostname into IP address.
Code:
import time
from datetime import datetime as dt
blk_site = [
"facebook.com",
"gmail.com",
]
Lin_host = "/etc/hosts"
def_host = Lin_host
ip = "127.0.0.1"
def block_websites (start_hour, end_hour):
while True:
if (
dt(dt.now().year, dt.now().month, dt.now().day, start_hour)
< dt.now()
< dt(dt.now().year, dt.now().month, dt.now().day, end_hour)
):
print("It's Working")
with open(def_host, "r+") as hostfile:
hosts = hostfile.read()
for site in blk_site:
if site not in hosts:
hostfile.write (ip + " " + site + "\n")
else:
with open(def_host, "r+") as hostfile:
hosts = hostfile.readlines ()
hostfile.seek (0)
for host in hosts:
if not any(site in host for site in blk_site):
hostfile.write (host)
hostfile.truncate ()
print ("Ad blocked")
time.sleep (3)
if __name__ == "__main__":
block_websites(9, 21)
4. Python project to create GIF creator
- GIF is a sequence of images that create the illusion of movement. Despite how well-known in recent years, demand for high-quality gifs is increasing. Here, we will create a GIF creator that will generate GIFs from images.
- For development purposes, we will be utilizing the MoviePy python module. To create a GIF creator first we need to import the MoviePy module into our code. This module is used to edit the video also we can create a composite video (also known as non-linear editing), or process the video. This module is also used to read and write the formats of video.
- In the below project we can see first we have imported the imageio module, after importing the module we have provided two images to create GIF.
- After providing the images we are using for loop to add the image one by one into the GIF. After ending of for loop we have saved the gif file name as python.gif by using imageio.mimsave method. This method is used to save our gif file into the specified location which we have given into the code.
Code:
import imageio
img_name = ["python.jpg", "googleQR.jpg"]
img = []
for imgname in img_name:
img.append (imageio.imread (imgname))
imageio.mimsave ('python.gif', img, 'GIF', duration=1)
5. Python project to convert the image into pencil sketch
- For this project, we will make use of the OpenCV library. Install it with pip install opencv-python. The below steps shows to create pencil sketch project from an image.
- Step 1: Locate an image to convert to a pencil sketch. We’ll make use of a python image.
- Step 2: Read the image and convert it to grayscale. The image has now been converted into a traditional black and white photograph.
- Step 3: Image invert into grayscale, which is also known as the negative image; this is our inverted grayscale image. Inversion is primarily used to highlight specifics.
- Step 4: Finally, mix the image to make the pencil sketch. The grayscale image is divided to accomplish this.
Code:
import cv2
py_img = cv2.imread ("python.jpg")
gray_img = cv2.cvtColor (py_img, cv2.COLOR_BGR2GRAY)
invt_img = 255 - gray_img
blur = cv2.GaussianBlur(invt_img, (21, 21), 0)
invt_blur = 255 - blur
pencil_skth = cv2.divide (gray_img, invt_blur, scale=256.0)
cv2.imshow ("Original Image", py_img)
cv2.imshow ("Pencil Sketch of Dog", pencil_skth)
cv2.waitKey (0)
Conclusion
Python programming is the primary focus of pure Python projects. A project allows us to group together with our libraries and personal settings into one unit. Python projects are implemented in every area on which we have developed the project. Python has grown in popularity to be a widely-used programming language.
Recommended Article
This is a guide to Python projects. Here we discuss the definition, Introduction, Top python projects examples along with code implementation and output. You may also have a look at the following articles to learn more –