
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

227 Views
In Python, when we are working with files and directories, it's common to delete a folder that contains other files and subfolders. To delete such non-empty directories, Python provides different methods to remove entire directory trees safely and efficiently. Removing Directories Using shutil.rmtree() In Python, we have the shutil.rmtree() method is used to delete an entire directory along with all its files and subdirectories. This method is straightforward and ideal for cleaning up directories recursively. This method takes the name of the directory or files as input. Following is the syntax of the shutil.rmtree() method - import shutil ... Read More

1K+ Views
In Python, when we are working with files that contain a large amount of data then it is often inefficient to read the entire content into memory at once. In such cases, we can read a fixed amount of data at a time by using the read() method with a specified size. This process is commonly known as buffered or chunk-based reading. The Chunk-based reading is a program to read a file piece-by-piece rather than loading it completely. This process is particularly helpful when handling large files, as it helps to reduce memory consumption and enhances performance during file processing operations. ... Read More

257 Views
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array. Element − Each item stored in an array is called an element. Index − Each location of an element in an array has a numerical index, which is used to identify the element. Example Live Demo public class ArrayExample { public static void main(String args[]){ int myArray[] = {44, 69, 89, 635}; for (int i = 0; i

8K+ Views
When dealing with large files in Python, it is not efficient to read the entire file into memory at once. In such cases, we can read the file in chunks using a specified buffer size. This helps reduce memory consumption and allows for efficient processing of large files. Following is the syntax of using the Buffer while reading a file - with open('filename', 'r') as file: chunk = file.read(buffer_size) Where, filename: The path of the file. 'r': Read mode buffer_size: Number of characters ... Read More

18K+ Views
There are two types of arrays in Java they are − Single dimensional array − A single dimensional array of Java is a normal array where, the array contains sequential elements (of same type) − int[] myArray = {10, 20, 30, 40} Example Live Demo public class TestArray { public static void main(String[] args) { double[] myList = {1.9, 2.9, 3.4, 3.5}; // Print all the array elements ... Read More

10K+ Views
Python uses arrays of bytes called strings to represent Unicode characters. In Python, string indexing ranges from 0 to n-1, where n is the length of the string. In a string of size n, the characters can be retrieved from 0 to n-1. For Example, we can index the string "Coding" as 0, 1, 2, 3, 4, 5, in which the length of the string is 6. The first character in the string "Coding" is represented by the number 0, and the characters o, d, i, n, and g are represented by the numbers 1, 2, 3, and 5, respectively. ... Read More

5K+ Views
In Python, a list is a dynamic array that can be expanded in size as needed. The maximum size of a list is limited by the system's memory and the platform's architecture. In this article, we will explore how to determine the maximum size of a list in Python. Understanding Python List Limits The size of a list in Python is not restricted by any fixed value set in the language itself but also it depends on below factors - Available system memory (RAM) System architecture, i.e., 32-bit or 64-bit The value of ... Read More

7K+ Views
In Python, strings are dynamic and can extend to a very large size, and can be limited only by the system's available memory. In other languages, compared to Python, it does not define a strict upper bound on string length. Instead, the practical maximum length of a string depends on the platform and memory constraints. In this article, we will explore how to determine the theoretical maximum string length in Python. Maximum Theoretical String Length Python strings are stored as sequences of Unicode characters, and the maximum size of a Python object is typically constrained by the value of sys.maxsize ... Read More

872 Views
In Python, floating-point numbers can be implemented using double-precision, i.e., 64-bit format, as per the IEEE 754 standard. These floats have a finite range and precision. The maximum value that a float can represent depends on the platform that we are using, but can be accessed using the sys.float_info attribute. Maximum Value of Float using sys.float_info The sys.float_info object provides details about the float implementation on the current platform. The attribute float_info.max gives the largest positive floating-point number representation. Example Here in this example, we are going to use float_info.max attribute from the sys.float_info object to get the maximum float value ... Read More

660 Views
Python allows dictionaries to be sorted using the built-in sorted() function. Although dictionaries in Python 3.7+ preserve insertion order, we can still create a new dictionary sorted by its keys using various methods. In this article, we will explore different ways to sort a dictionary in Python by its keys. Using sorted() with a for Loop We can use the sorted() function on the dictionary keys and then iterate through them to build a new dictionary in key order. Example Following is an example, which shows how to sort a dictionary in Python using the sorted() function - dictionary = ... Read More