<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sona</title>
    <description>The latest articles on DEV Community by Sona (@codingmadeeasy).</description>
    <link>https://dev.to/codingmadeeasy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1231393%2Fc9bd5421-9854-487f-a761-695c095e45f6.jpg</url>
      <title>DEV Community: Sona</title>
      <link>https://dev.to/codingmadeeasy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codingmadeeasy"/>
    <language>en</language>
    <item>
      <title>Unlock the power of effortless testing with PyTest—learn to write, execute, and automate your Python tests with ease!</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Tue, 24 Sep 2024 05:36:59 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/unlock-the-power-of-effortless-testing-with-pytest-learn-to-write-execute-and-automate-your-python-tests-with-ease-1a66</link>
      <guid>https://dev.to/codingmadeeasy/unlock-the-power-of-effortless-testing-with-pytest-learn-to-write-execute-and-automate-your-python-tests-with-ease-1a66</guid>
      <description>&lt;p&gt;Dive into this guide for hands-on examples and expert insights.&lt;/p&gt;

&lt;p&gt;PyTest is one of the most widely used testing frameworks for Python. Its simplicity, ease of use, and powerful capabilities make it ideal for both beginners and advanced users. This article will guide you through the core concepts of PyTest with detailed examples to help you understand how to write, execute, and manage your tests.&lt;/p&gt;

&lt;p&gt;Why Use PyTest?&lt;br&gt;
PyTest provides:&lt;/p&gt;

&lt;p&gt;Simple syntax to write tests&lt;br&gt;
Supports fixtures for code reuse&lt;br&gt;
Assertions with detailed failure messages&lt;br&gt;
Built-in support for parameterized testing&lt;br&gt;
Plugins to extend functionality&lt;br&gt;
Installation&lt;br&gt;
To install PyTest, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pytest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Writing Your First Test&lt;br&gt;
A basic test in PyTest is a function whose name starts with test_. PyTest will automatically discover and execute all such functions.&lt;/p&gt;

&lt;p&gt;Example 1: A Simple Test Case&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# test_sample.py

def test_addition():
    assert 1 + 2 == 3  # This will pass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;br&gt;
In the above example, the function test_addition contains an assertion that checks if 1 + 2 equals 3. If the assertion is correct, the test will pass.&lt;/p&gt;

&lt;p&gt;To run this test, execute:&lt;br&gt;
&lt;code&gt;pytest test_sample.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;PyTest will automatically discover and run the test case.&lt;/p&gt;

&lt;p&gt;Read More below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/24/getting-started-with-pytest-a-comprehensive-guide-with-code-examples/" rel="noopener noreferrer"&gt;https://codemagnet.in/2024/09/24/getting-started-with-pytest-a-comprehensive-guide-with-code-examples/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
    </item>
    <item>
      <title>BGR Color Palette with Trackbars Using Python and OpenCV</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Mon, 23 Sep 2024 08:47:29 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/bgr-color-palette-with-trackbars-using-python-and-opencv-1pi0</link>
      <guid>https://dev.to/codingmadeeasy/bgr-color-palette-with-trackbars-using-python-and-opencv-1pi0</guid>
      <description>&lt;p&gt;BGR Color Palette with Trackbars Using Python and OpenCV. OpenCV (Open Source Computer Vision Library) is a popular library designed for real-time computer vision tasks. It offers various functions to work with images and videos, making it an essential tool in computer vision applications.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will create an interactive RGB color palette with trackbars using OpenCV in Python. By adjusting these trackbars, the RGB values will change dynamically between 0 and 255, allowing you to experiment and find the exact color represented by those RGB values.&lt;/p&gt;

&lt;p&gt;Required Libraries:&lt;br&gt;
To build this RGB color palette, we will need the following libraries:&lt;/p&gt;

&lt;p&gt;OpenCV: For creating the window, trackbars, and capturing RGB values.&lt;br&gt;
NumPy: For handling arrays and creating a blank image (black window) where the colors will be displayed.&lt;br&gt;
Approach:&lt;br&gt;
We will create a blank black window with a resolution of 512×512 pixels and three color channels (Blue, Green, and Red). Using OpenCV’s built-in functions, we will set up trackbars to control the intensity of each color channel (BGR).&lt;/p&gt;

&lt;p&gt;The range for these trackbars will be from 0 to 255, allowing for the full spectrum of color values. As we move the trackbars, the RGB values will update in real-time, and the black window will change to reflect the new color.&lt;/p&gt;

&lt;p&gt;Steps:&lt;br&gt;
Create a Blank Black Window: Using NumPy, we will initialize a black window of 512×512 pixels, where each pixel has three channels for B, G, and R.&lt;br&gt;
Set Up Trackbars: With OpenCV’s createTrackbar() function, we will create three trackbars to control the Blue, Green, and Red color channels. These trackbars will allow the user to adjust the intensity of each color component.&lt;br&gt;
Update the Window in Real-Time: The values from the trackbars will be captured using getTrackbarPos() and used to modify the color displayed in the black window. Each time a trackbar is moved, the window will update to display the corresponding color based on the RGB values.&lt;br&gt;
Here’s the full Python code for this project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Importing required libraries
import cv2
import numpy as np

# Define an empty function to handle trackbar events
def emptyFunction():
    pass

def main():
    # Create a blank black image of size 512x512 pixels with 3 color channels (B, G, R)
    image = np.zeros((512, 512, 3), np.uint8)  
    windowName = "OpenCV Color Palette"

    # Create a window with the specified name
    cv2.namedWindow(windowName)

    # Create trackbars for Blue, Green, and Red colors
    # The trackbars range from 0 to 255, representing the color intensity
    cv2.createTrackbar('Blue', windowName, 0, 255, emptyFunction)
    cv2.createTrackbar('Green', windowName, 0, 255, emptyFunction)
    cv2.createTrackbar('Red', windowName, 0, 255, emptyFunction)

    # Infinite loop to keep the window open until the ESC key is pressed
    while True:
        # Display the current image in the window
        cv2.imshow(windowName, image)

        # Exit the loop when the ESC key is pressed (ASCII value 27)
        if cv2.waitKey(1) == 27:
            break

        # Get the current positions of the trackbars
        blue = cv2.getTrackbarPos('Blue', windowName)
        green = cv2.getTrackbarPos('Green', windowName)
        red = cv2.getTrackbarPos('Red', windowName)

        # Update the image by filling it with the new color values from the trackbars
        image[:] = [blue, green, red]

        # Print the current RGB values to the console
        print(blue, green, red)

    # Close all windows when the loop is terminated
    cv2.destroyAllWindows()

# Calling the main function
if __name__ == "__main__":
    main()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read More Below&lt;br&gt;
&lt;a href="https://codemagnet.in/2024/09/23/bgr-color-palette-with-trackbars-using-python-and-opencv/" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Table Creation Made Easy: Using Tkinter in Python</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Thu, 19 Sep 2024 09:37:14 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/table-creation-made-easy-using-tkinter-in-python-1205</link>
      <guid>https://dev.to/codingmadeeasy/table-creation-made-easy-using-tkinter-in-python-1205</guid>
      <description>&lt;p&gt;Python provides several options for developing graphical user interfaces (GUIs), with Tkinter being the most popular choice. Tkinter serves as the standard Python interface to the Tk GUI toolkit, which comes included with Python installations. It’s the quickest and easiest way to build GUI applications. Creating a GUI with Tkinter is straightforward and user-friendly.&lt;/p&gt;

&lt;p&gt;Creating Tables Using Tkinter&lt;/p&gt;

&lt;p&gt;Tables are useful for organizing data into rows and columns. While Tkinter does not include a dedicated Table widget, we can create tables using alternative methods. For instance, we can arrange Entry widgets in a grid format to simulate a table.&lt;/p&gt;

&lt;p&gt;To create a table with five rows and four columns, we can utilize nested for loops as follows:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;for i in range(5):&lt;br&gt;
    for j in range(4):&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Inside these loops, we have to create an Entry widget by creating an object of Entry class, as: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;e = Entry(root, width=20, fg='blue', font=('Arial', 16, 'bold')&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to implement the logic for positioning the Entry widgets in rows and columns. This can be achieved using the grid() method, where we specify the row and column indices for each widget, as follows:&lt;/p&gt;

&lt;p&gt;`# here i and j indicate &lt;/p&gt;

&lt;h1&gt;
  
  
  row and column positions
&lt;/h1&gt;

&lt;p&gt;e.grid(row=i, column=j)`&lt;/p&gt;

&lt;p&gt;We can insert data into the Entry widget using insert() method, as: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;e.insert(END, data)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this context, ‘END’ signifies that new data will be appended to the end of the existing content in the Entry widget. The following program demonstrates this logic by using data from a list.&lt;/p&gt;

&lt;p&gt;We have created a list containing five tuples, where each tuple includes four values representing a student’s ID, name, city, and age. As a result, we will have a table with five rows and four columns. This approach can also be adapted to display data retrieved from a database in a tabular format.&lt;/p&gt;

&lt;p&gt;Let’s us check out the full code:&lt;/p&gt;

&lt;p&gt;`# Python program to create a table&lt;/p&gt;

&lt;p&gt;from tkinter import *&lt;/p&gt;

&lt;p&gt;class Table:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def &lt;strong&gt;init&lt;/strong&gt;(self,root):
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# code for creating table
for i in range(total_rows):
    for j in range(total_columns):

        self.e = Entry(root, width=20, fg='blue',
                    font=('Arial',16,'bold'))

        self.e.grid(row=i, column=j)
        self.e.insert(END, lst[i][j])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  take the data&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;lst = [(1,'Rajesh','Delhi',19),&lt;br&gt;
    (2,'Paul','United kingdom',18),&lt;br&gt;
    (3,'Sonia','Mumbai',20),&lt;br&gt;
    (4,'Rachna','Hyderabad',21),&lt;br&gt;
    (5,'Dunccan','New york',21)]&lt;/p&gt;

&lt;h1&gt;
  
  
  find total number of rows and
&lt;/h1&gt;

&lt;h1&gt;
  
  
  columns in list
&lt;/h1&gt;

&lt;p&gt;total_rows = len(lst)&lt;br&gt;
total_columns = len(lst[0])&lt;/p&gt;

&lt;h1&gt;
  
  
  create root window
&lt;/h1&gt;

&lt;p&gt;root = Tk()&lt;br&gt;
t = Table(root)&lt;br&gt;
root.mainloop()`&lt;/p&gt;

&lt;p&gt;Check out the full output below&lt;br&gt;
&lt;a href="https://codemagnet.in/2024/09/19/table-creation-made-easy-using-tkinter-in-python/" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Unlock seamless file sharing with your own Python app</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Wed, 18 Sep 2024 12:02:11 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/unlock-seamless-file-sharing-with-your-own-python-app-4oli</link>
      <guid>https://dev.to/codingmadeeasy/unlock-seamless-file-sharing-with-your-own-python-app-4oli</guid>
      <description>&lt;p&gt;Computer Networks is a vital topic in computer science, and grasping its concepts often requires practical application. In this article, we will guide you through the process of creating a simple file-sharing application using Python. This project will not only reinforce your understanding of networking principles but also provide hands-on experience with relevant Python modules.&lt;/p&gt;

&lt;p&gt;What is an HTTP Web Server?&lt;br&gt;
An HTTP Web Server is software that understands URLs (web addresses) and the HTTP protocol, which is the foundation for viewing webpages. Python offers several packages that include a collection of modules to facilitate network programming, as well as built-in servers that simplify the development of web applications.&lt;/p&gt;

&lt;p&gt;Key Modules Used in This Project&lt;br&gt;
HTTPServer: This module, part of the socketserver package, creates and listens on the HTTP socket. It is essential for handling HTTP requests.&lt;br&gt;
Socketserver: This module simplifies the task of writing network servers, making it easier to create custom server functionalities.&lt;br&gt;
Webbrowser: This high-level interface allows us to open web-based documents easily by calling the open() function.&lt;br&gt;
PyQRCode: This module enables us to generate QR codes with just a couple of lines of code, providing a quick way to share information.&lt;br&gt;
OS Module: This module facilitates interaction with the operating system. It is used for opening files, manipulating paths, and reading files directly from the command line.&lt;br&gt;
PyPNG: This library allows for the reading and writing of PNG image files using pure Python, which is useful for handling QR codes in image format.&lt;br&gt;
Step-by-Step Approach&lt;br&gt;
Here’s a detailed outline of the steps involved in creating the file-sharing app:&lt;/p&gt;

&lt;p&gt;Install Required Modules: Begin by installing the necessary third-party modules via the command line:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install pyqrcode&lt;br&gt;
pip install pypng&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Import Necessary Modules: Import the following modules at the beginning of your Python script:&lt;/p&gt;

&lt;p&gt;`# import necessary modules&lt;/p&gt;

&lt;h1&gt;
  
  
  for implementing the HTTP Web servers
&lt;/h1&gt;

&lt;p&gt;import http.server&lt;/p&gt;

&lt;h1&gt;
  
  
  provides access to the BSD socket interface
&lt;/h1&gt;

&lt;p&gt;import socket&lt;/p&gt;

&lt;h1&gt;
  
  
  a framework for network servers
&lt;/h1&gt;

&lt;p&gt;import socketserver&lt;/p&gt;

&lt;h1&gt;
  
  
  to display a Web-based documents to users
&lt;/h1&gt;

&lt;p&gt;import webbrowser&lt;/p&gt;

&lt;h1&gt;
  
  
  to generate qrcode
&lt;/h1&gt;

&lt;p&gt;import pyqrcode&lt;br&gt;
from pyqrcode import QRCode&lt;/p&gt;

&lt;h1&gt;
  
  
  convert into png format
&lt;/h1&gt;

&lt;p&gt;import png&lt;/p&gt;

&lt;h1&gt;
  
  
  to access operating system control
&lt;/h1&gt;

&lt;p&gt;import os&lt;/p&gt;

&lt;h1&gt;
  
  
  assigning the appropriate port value
&lt;/h1&gt;

&lt;p&gt;PORT = 8010&lt;/p&gt;

&lt;h1&gt;
  
  
  this finds the name of the computer user
&lt;/h1&gt;

&lt;p&gt;os.environ['USERPROFILE']&lt;/p&gt;

&lt;h1&gt;
  
  
  changing the directory to access the files desktop
&lt;/h1&gt;

&lt;h1&gt;
  
  
  with the help of os module
&lt;/h1&gt;

&lt;p&gt;desktop = os.path.join(os.path.join(os.environ['USERPROFILE']),&lt;br&gt;
                       'OneDrive')&lt;br&gt;
os.chdir(desktop)&lt;/p&gt;

&lt;h1&gt;
  
  
  creating a http request
&lt;/h1&gt;

&lt;p&gt;Handler = http.server.SimpleHTTPRequestHandler&lt;/p&gt;

&lt;h1&gt;
  
  
  returns, host name of the system under
&lt;/h1&gt;

&lt;h1&gt;
  
  
  which Python interpreter is executed
&lt;/h1&gt;

&lt;p&gt;hostname = socket.gethostname()&lt;/p&gt;

&lt;h1&gt;
  
  
  finding the IP address of the PC
&lt;/h1&gt;

&lt;p&gt;s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)&lt;br&gt;
s.connect(("8.8.8.8", 80))&lt;br&gt;
IP = "http://" + s.getsockname()[0] + ":" + str(PORT)&lt;br&gt;
link = IP&lt;/p&gt;

&lt;h1&gt;
  
  
  converting the IP address into the form of a QRcode
&lt;/h1&gt;

&lt;h1&gt;
  
  
  with the help of pyqrcode module
&lt;/h1&gt;

&lt;h1&gt;
  
  
  converts the IP address into a Qrcode
&lt;/h1&gt;

&lt;p&gt;url = pyqrcode.create(link)&lt;/p&gt;

&lt;h1&gt;
  
  
  saves the Qrcode inform of svg
&lt;/h1&gt;

&lt;p&gt;url.svg("myqr.svg", scale=8)&lt;/p&gt;

&lt;h1&gt;
  
  
  opens the Qrcode image in the web browser
&lt;/h1&gt;

&lt;p&gt;webbrowser.open('myqr.svg')&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating the HTTP request and  serving the
&lt;/h1&gt;

&lt;h1&gt;
  
  
  folder in the PORT 8010,and the pyqrcode is generated
&lt;/h1&gt;

&lt;h1&gt;
  
  
  continuous stream of data between client and server
&lt;/h1&gt;

&lt;p&gt;with socketserver.TCPServer(("", PORT), Handler) as httpd:&lt;br&gt;
    print("serving at port", PORT)&lt;br&gt;
    print("Type this in your Browser", IP)&lt;br&gt;
    print("or Use the QRCode")&lt;br&gt;
    httpd.serve_forever()`&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Open the python file which has the above code on PC.&lt;br&gt;
This will generate a QR-code.&lt;br&gt;
Either Scan the QR-code or type the IP Address shown in the python shell in your mobile browser.&lt;br&gt;
Share the files with ease by scanning the QR-code that’s generated and get access to the files in PC, from the mobile browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56gwpmq1pzlw1bgrjk7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56gwpmq1pzlw1bgrjk7u.png" alt="Image description" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/18/file-sharing-made-easy-develop-your-own-app-with-python/" rel="noopener noreferrer"&gt;Read More Here&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>secrets to pristine Python programming with our essential guide</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Mon, 16 Sep 2024 05:17:44 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/secrets-to-pristine-python-programming-with-our-essential-guide-3fp9</link>
      <guid>https://dev.to/codingmadeeasy/secrets-to-pristine-python-programming-with-our-essential-guide-3fp9</guid>
      <description>&lt;p&gt;Elevate your coding game and master the art of elegant solutions! #python&lt;/p&gt;

&lt;p&gt;Essential Best Practices for Clean and Efficient Python Code Python has become one of the most popular programming languages in the world, surpassing even Java in terms of usage and study. Today, it ranks as the second most popular language after JavaScript and continues to gain ground rapidly.&lt;/p&gt;

&lt;p&gt;Python’s versatility is reflected in its extensive applications across various fields, including web development with frameworks like Django and Flask, web scraping, automation, system administration, DevOps, network programming, testing, data analysis, data science, machine learning, and artificial intelligence. It’s often the go-to language for data-related technologies.&lt;/p&gt;

&lt;p&gt;Best Practices for Writing Clean Python Code&lt;/p&gt;

&lt;p&gt;Python is highly favored by beginners due to its ease of learning, extensive community support, and comprehensive documentation. However, transitioning from languages like Java, C, C++, or JavaScript to Python can pose challenges, particularly when it comes to adhering to best practices for writing clean code. Clean code is crucial as it enhances readability, simplifies debugging, and contributes to overall code elegance. Let’s delve into some of the essential practices to achieve clean Python code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Effective Documentation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Incorporating clear and readable comments is fundamental for maintaining comprehensible code. Even complex programs can be made more understandable with well-placed comments. There are two main types of comments in Python:&lt;/p&gt;

&lt;p&gt;Single Line Comments: These comments are used for brief explanations and are preceded by a hash symbol (#). They extend to the end of the line.&lt;br&gt;
Multi-line Comments: These comments are useful for elaborating on larger blocks of code. They are enclosed in triple quotes (”’ or “””) and can also be used to define string literals. For extensive commentary, it’s generally better to use hash symbols for each line to avoid potential issues with string-based comments.&lt;br&gt;
For more details on comments, see: Comments in Python.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Consistent Indentation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unlike languages such as C++ or Java, Python uses indentation to define code blocks instead of braces. Indentation must be consistent throughout your code, using either spaces or tabs uniformly. Inconsistent indentation can lead to errors or misinterpretations of code structure. Here are examples demonstrating correct indentation:&lt;/p&gt;

&lt;p&gt;If-Else Statement:&lt;br&gt;
`if condition1:&lt;br&gt;
    # Code to execute if condition1 is True&lt;br&gt;
else:&lt;br&gt;
    # Code to execute if condition1 is False&lt;/p&gt;

&lt;p&gt;For Loop with Nested If-Else:&lt;/p&gt;

&lt;p&gt;To learn more about indentation, must read: Indentation in Python&lt;/p&gt;

&lt;p&gt;&lt;code&gt;for i in sequence:&lt;br&gt;
    if condition1:&lt;br&gt;
        # Code for the outer if block&lt;br&gt;
        if condition2:&lt;br&gt;
            # Code for the nested if block&lt;br&gt;
    else:&lt;br&gt;
        # Code for the outer else block&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/16/essential-best-practices-for-clean-and-efficient-python-code/" rel="noopener noreferrer"&gt;https://codemagnet.in/2024/09/16/essential-best-practices-for-clean-and-efficient-python-code/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>devops</category>
      <category>python</category>
    </item>
    <item>
      <title>Powerful llist module—your key to efficient data manipulation</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Mon, 16 Sep 2024 05:15:56 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/powerful-llist-module-your-key-to-efficient-data-manipulation-3ia9</link>
      <guid>https://dev.to/codingmadeeasy/powerful-llist-module-your-key-to-efficient-data-manipulation-3ia9</guid>
      <description>&lt;p&gt;Master the art of linked lists in Python with the powerful llist module—your key to efficient data manipulation. Unlock speed and flexibility in list management with this developer-friendly guide! #python&lt;/p&gt;

&lt;p&gt;Python llist module: A Step-by-Step Guide for Developers. For a long time, Python did not have a built-in way to implement the linked list data structure. Although Python supports lists, they have limitations when used in scenarios requiring the dynamic nature of a linked list.&lt;/p&gt;

&lt;p&gt;A standard Python list is rigid because its elements are stored in contiguous memory locations, which are not connected by pointers. This leads to inefficiencies, such as wasting memory space when the list is not fully filled, as it reserves a defined block of memory.&lt;/p&gt;

&lt;p&gt;To address some of these issues, Python’s deque (double-ended queue) data structure has been used as a substitute to function like a linked list. However, the deque structure also has limitations, especially in terms of flexibility and speed.&lt;/p&gt;

&lt;p&gt;To overcome these challenges, Python now has the llist module, which is specifically designed to provide an efficient and functional linked list implementation.&lt;/p&gt;

&lt;p&gt;The llist Module in Python&lt;br&gt;
The llist module is a powerful extension for CPython that introduces a fundamental linked list structure. It offers a more efficient solution for linked list operations than Python’s built-in list and even the deque. The llist module is optimized for speed and is significantly faster than both deque and list when it comes to managing linked list operations.&lt;/p&gt;

&lt;p&gt;Installation&lt;br&gt;
To use the llist module, you need to install it, just like any other Python extension or package. You can install it using pip with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install llist&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, if you prefer manual installation, you can download the package from the Python Package Index (PyPI) at &lt;a href="http://pypi.python.org/pypi" rel="noopener noreferrer"&gt;http://pypi.python.org/pypi&lt;/a&gt;. After downloading, unpack the resources and compile them using the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python setup.py install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once installed, you can import the llist module and start using it in your programs.&lt;/p&gt;

&lt;p&gt;Methods and Objects Provided by the llist Module&lt;br&gt;
The llist module provides two types of linked list implementations:&lt;/p&gt;

&lt;p&gt;Singly Linked List (sllist): A linked list where each node points to the next node in the sequence.&lt;br&gt;
Doubly Linked List (dllist): A linked list where each node contains references to both the previous and the next node, allowing bidirectional traversal.&lt;br&gt;
Objects in the llist Module&lt;br&gt;
dllist: This object implements a doubly linked list.&lt;br&gt;
dllistnode: This creates a new node for a doubly linked list. You can optionally initialize it with data.&lt;br&gt;
dllistiterator: An iterator object to traverse through a doubly linked list.&lt;br&gt;
sllist: This object implements a singly linked list.&lt;br&gt;
sllistnode: A node for a singly linked list, optionally initialized with data.&lt;br&gt;
sllistiterator: An iterator object to traverse through a singly linked list.&lt;br&gt;
Explanation of Linked Lists in the llist Module&lt;br&gt;
Singly Linked List (sllist): Each node in a singly linked list points only to the next node in the sequence. This means you can traverse the list in a single direction. The head node points to the next node, and so on, until you reach the end, where the last node’s pointer is None.&lt;br&gt;
Doubly Linked List (dllist): Each node in a doubly linked list contains two pointers: one to the next node and one to the previous node. This allows traversal in both directions, making it more flexible than a singly linked list, especially when you need to navigate back and forth through the list.&lt;br&gt;
These linked list structures are extremely useful when you need to manage dynamic data collections where elements are frequently added or removed. They provide more memory-efficient solutions compared to standard Python lists, especially in scenarios where there are unpredictable amounts of data, and memory conservation is essential.&lt;/p&gt;

&lt;p&gt;The following examples will help clarify how the llist module works by demonstrating the basic operations for the two types of lists it supports. Here’s an example using the sllist (singly linked list) to illustrate how to create, manipulate, and manage linked lists in Python:&lt;/p&gt;

&lt;p&gt;Example 1: Singly Linked List (sllist)&lt;/p&gt;

&lt;p&gt;`# Importing the required packages&lt;br&gt;
import llist&lt;br&gt;
from llist import sllist, sllistnode&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating a singly linked list with initial values
&lt;/h1&gt;

&lt;p&gt;lst = sllist(['first', 'second', 'third'])&lt;br&gt;
print(lst)              # Output: sllist with elements 'first', 'second', 'third'&lt;br&gt;
print(lst.first)        # Output: First node in the list ('first')&lt;br&gt;
print(lst.last)         # Output: Last node in the list ('third')&lt;br&gt;
print(lst.size)         # Output: Number of elements in the list (3)&lt;br&gt;
print()&lt;/p&gt;

&lt;h1&gt;
  
  
  Adding a new element to the end of the list and inserting a value after a specific node
&lt;/h1&gt;

&lt;p&gt;lst.append('fourth')    # Adds 'fourth' to the end of the list&lt;br&gt;
node = lst.nodeat(2)    # Gets the node at index 2 ('third')&lt;br&gt;
lst.insertafter('fifth', node)  # Inserts 'fifth' after the node 'third'&lt;br&gt;
print(lst)              # Output: Updated list with 'first', 'second', 'third', 'fifth', 'fourth'&lt;br&gt;
print(lst.first)        # Output: First node ('first')&lt;br&gt;
print(lst.last)         # Output: Last node ('fourth')&lt;br&gt;
print(lst.size)         # Output: Size of the list (5)&lt;br&gt;
print()&lt;/p&gt;

&lt;h1&gt;
  
  
  Popping a value from the list (removing the last element)
&lt;/h1&gt;

&lt;p&gt;lst.pop()               # Removes 'fourth' from the list&lt;br&gt;
print(lst)              # Output: List without 'fourth'&lt;br&gt;
print(lst.first)        # Output: First node ('first')&lt;br&gt;
print(lst.last)         # Output: Last node ('fifth')&lt;br&gt;
print(lst.size)         # Output: Size of the list (4)&lt;br&gt;
print()&lt;/p&gt;

&lt;h1&gt;
  
  
  Removing a specific element from the list
&lt;/h1&gt;

&lt;p&gt;node = lst.nodeat(1)    # Gets the node at index 1 ('second')&lt;br&gt;
lst.remove(node)        # Removes the 'second' node from the list&lt;br&gt;
print(lst)              # Output: List with 'first', 'third', 'fifth'&lt;br&gt;
print(lst.first)        # Output: First node ('first')&lt;br&gt;
print(lst.last)         # Output: Last node ('fifth')&lt;br&gt;
print(lst.size)         # Output: Size of the list (3)&lt;br&gt;
print()`&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
Creating the List: A singly linked list (sllist) is created with initial values (‘first’, ‘second’, ‘third’). We can print the entire list, its first and last nodes, and the size of the list.&lt;br&gt;
Appending and Inserting Elements: The append() method adds a new element (‘fourth’) to the end of the list. Using insertafter(), we can insert a new node (‘fifth’) after a specified node (‘third’).&lt;br&gt;
Popping Elements: The pop() method removes the last element from the list.&lt;br&gt;
Removing Specific Elements: The remove() method allows us to remove a specific node, such as the second element (‘second’).&lt;br&gt;
This example shows the flexibility of using sllist in the llist module to manage linked lists, allowing efficient insertion, deletion, and access to elements.&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;`dllist([first, second, third])&lt;br&gt;
dllistnode(first)&lt;br&gt;
dllistnode(third)&lt;br&gt;
3&lt;/p&gt;

&lt;p&gt;dllist([sixth, fifth, seventh, first, second, third, fourth])&lt;br&gt;
dllistnode(sixth)&lt;br&gt;
dllistnode(fourth)&lt;br&gt;
7&lt;/p&gt;

&lt;p&gt;dllist([sixth, fifth, seventh, first, second, third])&lt;br&gt;
dllistnode(sixth)&lt;br&gt;
dllistnode(third)&lt;br&gt;
6&lt;/p&gt;

&lt;p&gt;dllist([sixth, seventh, first, second, third])&lt;br&gt;
dllistnode(sixth)&lt;br&gt;
dllistnode(third)&lt;br&gt;
5`&lt;/p&gt;

&lt;p&gt;Read More Below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/12/python-llist-module-a-step-by-step-guide-for-developers/" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Turn your Python skills into a lyrical maestro with a sleek GUI that fetches song lyrics at the click of a button</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Fri, 13 Sep 2024 06:11:21 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/turn-your-python-skills-into-a-lyrical-maestro-with-a-sleek-gui-that-fetches-song-lyrics-at-the-click-of-a-button-a4i</link>
      <guid>https://dev.to/codingmadeeasy/turn-your-python-skills-into-a-lyrical-maestro-with-a-sleek-gui-that-fetches-song-lyrics-at-the-click-of-a-button-a4i</guid>
      <description>&lt;p&gt;In this article, we’ll create a Python script to extract song lyrics and integrate it with a GUI application. We’ll use the lyrics-extractor library, which retrieves lyrics by searching various websites based on the song’s name. To begin, you’ll need to install the lyrics-extractor module. You can do this by running the following command in your terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install lyrics-extractor&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;API Key and Engine ID: You need these from Google Custom Search JSON API.&lt;br&gt;
Engine ID: Create a Custom Search Engine (CSE) to obtain your Engine ID here.&lt;br&gt;
Set up your Programmable Search Engine (Google Custom Search Engine) and include links to fetch lyrics. Programmable Search Engine leverages Google’s search technology to locate information based on user queries.You can choose any of the following links to configure your search engine:&lt;br&gt;
Genius&lt;br&gt;
Lyricsted&lt;br&gt;
Lyricsbell&lt;br&gt;
Glamsham&lt;br&gt;
Lyricsoff&lt;br&gt;
Lyricsmint&lt;br&gt;
JSON API: The Custom Search JSON API retrieves and displays results from your Programmable Search Engine. To use this API, you’ll need to create a Programmable Search Engine and obtain an API key (&lt;a href="https://developers.google.com/custom-search/v1/overview#api_key" rel="noopener noreferrer"&gt;https://developers.google.com/custom-search/v1/overview#api_key&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Approach:&lt;br&gt;
Import the necessary modules:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from lyrics_extractor import SongLyrics&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Initialize the SongLyrics class with your Google Custom Search JSON API key and Engine ID:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;extract_lyrics = SongLyrics(Your_API_KEY, GCS_ENGINE_ID)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Retrieve the lyrics by passing the song name to the get_lyrics() method:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lyrics = extract_lyrics.get_lyrics("Shape of You")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Get the API KEY and GCS_ENGINE_ID from here&lt;/p&gt;

&lt;p&gt;Full Code:&lt;/p&gt;

&lt;p&gt;`# importing modules&lt;br&gt;
from lyrics_extractor import SongLyrics&lt;/p&gt;

&lt;h1&gt;
  
  
  pass the GCS_API_KEY, GCS_ENGINE_ID
&lt;/h1&gt;

&lt;p&gt;extract_lyrics = SongLyrics("GCS_API_KEY","GCS_ENGINE_ID")&lt;/p&gt;

&lt;p&gt;extract_lyrics.get_lyrics("Tujhse Naraj Nahi Zindagi Lyrics")`&lt;/p&gt;

&lt;p&gt;Read More Below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/13/gui-to-extract-lyrics-from-song-using-python/" rel="noopener noreferrer"&gt;https://codemagnet.in/2024/09/13/gui-to-extract-lyrics-from-song-using-python/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Unlock the power of Python's property() function</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Wed, 04 Sep 2024 10:35:10 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/unlock-the-power-of-pythons-property-function-5199</link>
      <guid>https://dev.to/codingmadeeasy/unlock-the-power-of-pythons-property-function-5199</guid>
      <description>&lt;p&gt;The Python property() function is a built-in feature that returns an object of the property class and is used to create class properties. This function provides a way to define properties in Python, allowing for controlled access to an object’s attributes. In this article, we will explore how the property() function works in Python.&lt;/p&gt;

&lt;p&gt;Syntax of Python property() Function&lt;br&gt;
The property() function is used to create properties within a class.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;code&gt;property(fget, fset, fdel, doc)&lt;/code&gt;&lt;br&gt;
Parameters:&lt;/p&gt;

&lt;p&gt;fget(): Retrieves the attribute’s value.&lt;br&gt;
fset(): Sets the attribute’s value.&lt;br&gt;
fdel(): Deletes the attribute.&lt;br&gt;
doc(): A string that holds the documentation for the attribute.&lt;br&gt;
Return: The function returns a property object created from the specified getter, setter, and deleter functions.&lt;/p&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;p&gt;If no arguments are provided, the property() function returns a base property object without a getter, setter, or deleter.&lt;br&gt;
If the doc parameter isn’t provided, the property() function will use the docstring of the getter function.&lt;br&gt;
Understanding the property() Function in Python&lt;br&gt;
The property() function in Python is a built-in tool that allows the creation of special attributes known as properties within a class. Properties enable you to encapsulate access to an attribute and introduce additional logic, such as validation or computation, when the attribute is accessed or modified.&lt;br&gt;
Methods to Create Properties in Python&lt;br&gt;
There are two primary ways to create properties in Python:&lt;/p&gt;

&lt;p&gt;Using the property() function:&lt;br&gt;
This method allows you to manually create properties by defining getter, setter, and deleter methods.&lt;br&gt;
Using the @property decorator:&lt;br&gt;
This approach simplifies the process by using decorators to define properties.&lt;br&gt;
Example: Creating a Property with the property() Function&lt;br&gt;
In this example, we use the property() function to define a property within a class. We create a class named Alphabet and define a property called value.&lt;/p&gt;

&lt;p&gt;This property controls how the internal attribute _value is accessed and modified by defining custom getter and setter methods.&lt;/p&gt;

&lt;p&gt;`# Python program to explain property() function&lt;/p&gt;

&lt;h1&gt;
  
  
  Alphabet class
&lt;/h1&gt;

&lt;p&gt;class Alphabet:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, value):&lt;br&gt;
        self._value = value&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# getting the values&lt;br&gt;
def getValue(self):&lt;br&gt;
    print('Getting value')&lt;br&gt;
    return self._value
&lt;h1&gt;
  
  
  setting the values
&lt;/h1&gt;

&lt;p&gt;def setValue(self, value):&lt;br&gt;
    print('Setting value to ' + value)&lt;br&gt;
    self._value = value&lt;/p&gt;
&lt;h1&gt;
  
  
  deleting the values
&lt;/h1&gt;

&lt;p&gt;def delValue(self):&lt;br&gt;
    print('Deleting value')&lt;br&gt;
    del self._value&lt;/p&gt;

&lt;p&gt;value = property(getValue, setValue, &lt;br&gt;
                 delValue, )&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  passing the value&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;x = Alphabet('Codemagnet')&lt;br&gt;
print(x.value)&lt;/p&gt;

&lt;p&gt;x.value = 'CM'&lt;/p&gt;

&lt;p&gt;del x.value&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;code&gt;Getting value&lt;br&gt;
Codemagnet&lt;br&gt;
Setting value to CM&lt;br&gt;
Deleting value&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using the @property Decorator&lt;br&gt;
Decorators in Python are like add-ons that give extra features to your existing code. The @property decorator is a tool that makes your methods behave like regular attributes of a class.&lt;/p&gt;

&lt;p&gt;This technique is part of something called metaprogramming, where one part of the program changes another part during the compile time.&lt;/p&gt;

&lt;p&gt;Here’s how it works: when you define a method in your class and use the @property decorator, you’re turning that method into an attribute. This means you can access it like a regular variable, but behind the scenes, Python will call the method to get its value.&lt;/p&gt;

&lt;p&gt;If you then define the same method again with a @value.setter or @value.deleter, you’re telling Python how to set or delete that attribute.&lt;/p&gt;

&lt;p&gt;In simple terms, using @property lets you control what happens when you get, set, or delete a value in your class, all while making your code look clean and simple.&lt;/p&gt;

&lt;p&gt;When you access x.value, Python will automatically know whether you’re trying to get, set, or delete the value and will call the right method for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/09/04/a-beginners-guide-to-the-python-property-function-with-examples/" rel="noopener noreferrer"&gt;Read More Below&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Mastering Python RegEx: Comprehensive Guide with Practical Examples</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Wed, 04 Sep 2024 06:04:02 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/mastering-python-regex-comprehensive-guide-with-practical-examples-274a</link>
      <guid>https://dev.to/codingmadeeasy/mastering-python-regex-comprehensive-guide-with-practical-examples-274a</guid>
      <description>&lt;p&gt;Regular Expressions, commonly known as RegEx or RegExp, are a powerful tool for matching patterns in text. They are widely used in programming languages like Python for tasks such as data validation, searching, and string manipulation.&lt;/p&gt;

&lt;p&gt;This article provides a detailed exploration of Python’s RegEx capabilities, along with practical coding examples to illustrate their use.&lt;/p&gt;

&lt;p&gt;What is a Regular Expression?&lt;br&gt;
A Regular Expression is a sequence of characters that forms a search pattern. It can be used to check if a string contains a specified search pattern or to find and replace strings that match the pattern. In Python, the re module is used to work with regular expressions.&lt;/p&gt;

&lt;p&gt;Basic Syntax of Python RegEx&lt;br&gt;
Before diving into examples, it’s essential to understand the basic syntax used in Python RegEx:&lt;/p&gt;

&lt;p&gt;.: Matches any character except a newline.&lt;br&gt;
^: Matches the start of a string.&lt;br&gt;
$: Matches the end of a string.&lt;br&gt;
*: Matches 0 or more repetitions of the preceding pattern.&lt;br&gt;
+: Matches 1 or more repetitions of the preceding pattern.&lt;br&gt;
?: Matches 0 or 1 occurrence of the preceding pattern.&lt;br&gt;
{n}: Matches exactly n occurrences of the preceding pattern.&lt;br&gt;
{n,}: Matches n or more occurrences of the preceding pattern.&lt;br&gt;
{n,m}: Matches between n and m occurrences of the preceding pattern.&lt;br&gt;
[]: Matches any one of the characters inside the brackets.&lt;br&gt;
|: Matches either the pattern before or the pattern after the |.&lt;br&gt;
() : Groups patterns.&lt;br&gt;
Importing the re Module&lt;br&gt;
To use RegEx in Python, you need to import the re module, which provides various functions to work with regular expressions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import re&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Common RegEx Functions in Python&lt;br&gt;
The re module provides several functions that allow you to perform operations using regular expressions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;re.search()
The re.search() function searches the string for a match and returns the first occurrence.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;`import re&lt;/p&gt;

&lt;p&gt;pattern = r"hello"&lt;br&gt;
text = "hello world"&lt;br&gt;
match = re.search(pattern, text)&lt;/p&gt;

&lt;p&gt;if match:&lt;br&gt;
    print("Match found:", match.group())&lt;br&gt;
else:&lt;br&gt;
    print("No match found")&lt;/p&gt;

&lt;p&gt;`&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
This example searches for the word “hello” in the string “hello world”. If found, it prints the match.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;re.findall()
The re.findall() function returns a list of all matches found in the string.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;`import re&lt;/p&gt;

&lt;p&gt;pattern = r"\d+"&lt;br&gt;
text = "There are 123 apples and 456 oranges."&lt;br&gt;
matches = re.findall(pattern, text)&lt;/p&gt;

&lt;p&gt;print("Matches:", matches)`&lt;/p&gt;

&lt;p&gt;Explanation:&lt;br&gt;
This example searches for all sequences of digits in the string and returns them as a list.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;re.split()
The re.split() function splits the string by occurrences of the pattern.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;`import re&lt;/p&gt;

&lt;p&gt;pattern = r"\s+"&lt;br&gt;
text = "Split this string into words"&lt;br&gt;
split_text = re.split(pattern, text)&lt;/p&gt;

&lt;p&gt;print("Split text:", split_text)`&lt;br&gt;
&lt;a href="https://codemagnet.in/2024/09/04/mastering-python-regex-comprehensive-guide-with-practical-examples/" rel="noopener noreferrer"&gt;&lt;br&gt;
Read More Below&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>devops</category>
      <category>python</category>
    </item>
    <item>
      <title>Moving Object Detection with OpenCv &amp; Imutils</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Wed, 15 May 2024 04:18:51 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/moving-object-detection-with-opencv-imutils-37h1</link>
      <guid>https://dev.to/codingmadeeasy/moving-object-detection-with-opencv-imutils-37h1</guid>
      <description>&lt;p&gt;Detecting moving objects in a video stream is a key task in many computer vision applications. Using OpenCV and Imutils, we can create a program that analyzes video frames to identify areas where there is motion. This can be useful in surveillance, tracking, and many other fields where detecting motion is important. In this article, we’ll explore how to use these libraries to create a simple motion detection program.&lt;/p&gt;

&lt;p&gt;Let’s check out the code below for the same along with the output&lt;/p&gt;

&lt;p&gt;you need to first create a file with .py extension and copy the below code and paste it there&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import cv2 #image
import time #delay
import imutils #resize

cam = cv2.VideoCapture(0) #cam id
time.sleep(1)

firstFrame=None
area = 500

while True:
    _,img = cam.read() #read frame from camera
    text = "Normal" 
    img = imutils.resize(img, width=500) #resize

    grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #color 2 Gray scale image

    gaussianImg = cv2.GaussianBlur(grayImg, (21, 21), 0) #smoothened

    if firstFrame is None:
            firstFrame = gaussianImg #capturing 1st frame on 1st iteration
            continue

    imgDiff = cv2.absdiff(firstFrame, gaussianImg) #absolute diff b/w 1st nd current frame

    threshImg = cv2.threshold(imgDiff, 25, 255, cv2.THRESH_BINARY)[1] #binary

    threshImg = cv2.dilate(threshImg, None, iterations=2)

    cnts = cv2.findContours(threshImg.copy(), cv2.RETR_EXTERNAL,
            cv2.CHAIN_APPROX_SIMPLE)

    cnts = imutils.grab_contours(cnts)
    for c in cnts:
            if cv2.contourArea(c) &amp;lt; area:
                    continue
            (x, y, w, h) = cv2.boundingRect(c)
            cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
            text = "Moving Object detected"
    print(text)
    cv2.putText(img, text, (10, 20),
            cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
    cv2.imshow("cameraFeed",img)
    key = cv2.waitKey(1) &amp;amp; 0xFF
    if key == ord("q"):
        break

cam.release()
cv2.destroyAllWindows()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://codemagnet.in/2024/05/14/moving-object-detection-with-opencv-imutils/"&gt;Read More Here&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>Python SciPy Full Tutorial – In Depth Analysis</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Tue, 30 Apr 2024 03:55:41 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/python-scipy-full-tutorial-in-depth-analysis-2f29</link>
      <guid>https://dev.to/codingmadeeasy/python-scipy-full-tutorial-in-depth-analysis-2f29</guid>
      <description>&lt;p&gt;SciPy stands for Scientific Python. It provides more utility functions for optimization, stats and signal processing. Like NumPy, SciPy is open source so we can use it freely.&lt;/p&gt;

&lt;p&gt;The most important question is why to use SciPy?&lt;/p&gt;

&lt;p&gt;If SciPy uses NumPy underneath, why can we not just use NumPy?&lt;/p&gt;

&lt;p&gt;The simplest answer would be SciPy has optimized and added functions that are frequently used in NumPy and Data Science.&lt;/p&gt;

&lt;p&gt;How To Install SciPy?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install scipy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, once scipy is installed you can import it into your file or application from scipy import module statement:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from scipy import constants&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, that you have imported the scipt module lets take a example and see how this module is used.&lt;/p&gt;

&lt;p&gt;Example: We want to find out how many cubic meters are in one liter&lt;/p&gt;

&lt;p&gt;`from scipy import constants&lt;/p&gt;

&lt;p&gt;print(constants.liter)`&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/04/30/python-scipy-full-tutorial-in-depth-analysis/"&gt;Read More Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Convert Python Dict to JSON: Full Tutorial For Beginner</title>
      <dc:creator>Sona</dc:creator>
      <pubDate>Tue, 16 Apr 2024 04:14:51 +0000</pubDate>
      <link>https://dev.to/codingmadeeasy/convert-python-dict-to-json-full-tutorial-for-beginner-33hj</link>
      <guid>https://dev.to/codingmadeeasy/convert-python-dict-to-json-full-tutorial-for-beginner-33hj</guid>
      <description>&lt;p&gt;When you’re coding in Python, you often deal with JSON, its a format that is used to store and exchange data. If you’ve worked with APIs, you’ve likely parsed JSON responses before.&lt;/p&gt;

&lt;p&gt;JSON is like a dictionary in Python, storing data as key-value pairs, making it easy to understand and work with. Python’s json module helps convert Python dictionaries to JSON strings and vice versa.&lt;/p&gt;

&lt;p&gt;In this tutorial, our main focus is on converting python dictionaries to JSON using the json module. Let’s dive into the code!&lt;/p&gt;

&lt;p&gt;Now, to convert a Python dictionary to JSON string, you can use the dumps() function from the json module. The dumps() function takes in a Python object and returns the JSON string representation. In practice, however, you’ll need to convert not a single dictionary but a collection such as a list of dictionaries.&lt;/p&gt;

&lt;p&gt;Let us take an example.&lt;/p&gt;

&lt;p&gt;In this example, we first import the json module. Then, we create a list of dictionaries called data. Next, we use the json.dumps() function to convert the data list into a JSON string. Finally, we print the JSON string to the console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codemagnet.in/2024/04/15/convert-python-dict-to-json-full-tutorial-for-beginner/"&gt;Read More Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
