Nitya Raut

Nitya Raut

158 Articles Published

Articles by Nitya Raut

158 articles

urllib.robotparser - Parser for robots.txt in Python

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 825 Views

Web site owners use the /robots.txt file to give instructions about their site to web robots; this is called The Robots Exclusion Protocol. This file is a simple text-based access control system for computer programs that automatically access web resources. Such programs are called spiders, crawlers, etc. The file specifies the user agent identifier followed by a list of URLs the agent may not access. Example robots.txt File #robots.txt Sitemap: https://example.com/sitemap.xml User-agent: * Disallow: /admin/ Disallow: /downloads/ Disallow: /media/ Disallow: /static/ This file is usually put in the top-level directory of your web server. ...

Read More

urllib.parse — Parse URLs into components in Python

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 9K+ Views

The urllib.parse module provides a standard interface to break Uniform Resource Locator (URL) strings into components or to combine the components back into a URL string. It also has functions to convert a "relative URL" to an absolute URL given a "base URL." This module supports the following URL schemes: file ftp gopher hdl http https imap mailto mms ...

Read More

Optimization Tips for Python Code?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 402 Views

Python may not be as fast as compiled languages, but proper optimization techniques can significantly improve performance. Many large companies successfully use Python for heavy workloads by applying smart optimization strategies. Use Built-in Functions Built-in functions are written in C and are much faster than custom Python code. Always prefer built-ins when available ? # Fast - using built-in sum() numbers = [1, 2, 3, 4, 5] total = sum(numbers) print(total) # Slower - manual loop total = 0 for num in numbers: total += num print(total) 15 ...

Read More

Determine the type of an image in Python?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 4K+ Views

In this section, we are going to see how to determine the type of image file programmatically using Python. Consider a situation where you have hundreds of image files in a directory and want to filter specific image formats like JPEG, PNG, or GIF. Python provides the imghdr library to determine the type of an image contained in a file or byte stream. Installation The imghdr module is a standard library package that comes with Python 3.6 and higher installations. However, if you need to install it separately, run the following command ? pip install ...

Read More

Calculate distance and duration between two places using google distance matrix API in Python?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 893 Views

We almost all use Google Maps to check distance between source and destination and check the travel time. For developers and enthusiasts, Google provides the Google Distance Matrix API to calculate the distance and duration between two places programmatically. To use Google Distance Matrix API, we need Google Maps API keys, which you can get from the official documentation: https://developers.google.com/maps/documentation/distance-matrix/get-api-key Required Libraries We can accomplish this by using different Python libraries: requests − For making HTTP API calls json − For parsing JSON responses googlemaps − Official Google Maps client (optional) pandas − For ...

Read More

Phyllotaxis pattern in Python?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 478 Views

Phyllotaxis is the arrangement of leaves, flowers, or seeds on a plant stem following mathematical patterns found in nature. This pattern creates beautiful spirals similar to those seen in sunflowers, pine cones, and nautilus shells, based on the golden angle of approximately 137.5 degrees. Understanding Phyllotaxis The phyllotaxis pattern is closely related to the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21...), where each number is the sum of the two preceding ones. In nature, plants use this mathematical principle to maximize sunlight exposure and optimize space utilization. Fibonacci Sequence in Nature ...

Read More

Image based Steganography using Python?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 1K+ Views

Steganography is a technique of hiding information behind the scene. Unlike cryptography which focuses on encrypting data through algorithms like SHA1 or MD5, steganography focuses on hiding data (files, images, messages, or videos) within another medium to avoid detection. In this tutorial, we'll create a Python program that hides information behind an image without noticeable changes to the image appearance. The program has two main components ? an encoding function to embed secret messages into images, and a decoding function to extract hidden information. Installation We'll use the Python Pillow library and the stepic library for steganography ...

Read More

Readability Index in Python(NLP)?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 1K+ Views

A readability index is a numeric value that indicates how difficult (or easy) it is to read and understand a text. In Natural Language Processing (NLP), readability analysis helps determine the complexity level of written content, making it essential for educational materials, technical documentation, and content optimization. Readability describes the ease with which a document can be read. There exist many different tests to calculate readability, each designed for specific languages and use cases. These tests are considered predictions of reading ease and provide valuable insights for content creators and educators. Common Readability Tests Different readability tests ...

Read More

Reading images using Python?

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 8K+ Views

Reading images is a fundamental task in computer vision and image processing. Python offers several powerful libraries for this purpose, with OpenCV and PIL (Pillow) being the most popular choices. This tutorial covers both approaches for reading, displaying, and saving images. Installing Required Libraries First, install the necessary packages using pip − $ pip install opencv-python $ pip install numpy $ pip install Pillow Reading Images Using OpenCV OpenCV (Open Source Computer Vision) is a comprehensive library for computer vision tasks. It provides over 2, 500 optimized algorithms for image processing, machine learning, ...

Read More

Difference between Byte stuffing and Bit stuffing

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 21K+ Views

The differences between byte stuffing and bit stuffing are fundamental techniques used in data link layer framing to handle delimiter conflicts when transmitting data frames. What are Byte Stuffing and Bit Stuffing? Byte stuffing is a mechanism to convert a message formed of a sequence of bytes that may contain reserved values such as frame delimiters, into another byte sequence that does not contain the reserved values. This technique is also called character-oriented framing. Bit stuffing is the mechanism of inserting one or more non-information bits into a message to be transmitted, to break up the message ...

Read More
Showing 1–10 of 158 articles
« Prev 1 2 3 4 5 16 Next »
Advertisements