Rajendra Dharmkar has Published 452 Articles

What is the difference between os.open() and os.fdopen() in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 10:13:28

634 Views

Python has a wide array of modules and tools for solving real-world problems; among them, the os module provides various functions for working with the operating system and performing several useful file operations. Two commonly used functions in the os module, namely, os.open() and os.fdopen() are used for opening files. ... Read More

How to write binary data to a file using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 09:59:05

27K+ Views

It is a common and routine task in Python; the act of writing binary data to a file when you need to save non-textual data such as images, audio files, or serialized objects. In this article, we will explore various ways how you can write binary data to a file ... Read More

How to set the current working directory in Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 09:50:41

1K+ Views

The current working directory in Python is defined as the directory from where the Python script is being executed. By default, the current working directory is usually the directory where the script is stored, located or resides. However, there may arise scenarios or instances where you may want to change ... Read More

How to set creation and modification date/time of a file using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 09:41:43

7K+ Views

The creation and modification datetime of a file in Python are defined as the timestamps associated with the events of when the file was created and when it was last modified. Creation datetime: It is defined as the timestamp when a file was initially created or added to ... Read More

How to rename multiple files recursively using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 09:36:59

3K+ Views

The act of renaming multiple files recursively in Python can be a useful task when it is required to change the names of multiple files within a directory and its subdirectories. If you need to replace certain characters, add prefixes or suffixes, or completely change the file names, Python has ... Read More

How to rename directory using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 25-Jul-2023 09:31:07

8K+ Views

There are times when you want to organize your files or update the directory names to better reflect their contents. In such scenarios, the operation of renaming directories becomes helpful and it is a common task that we often encounter in Python file management. There is provision of several modules ... Read More

How to remove a file using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 24-Jul-2023 20:42:18

254 Views

There will be times when we need to remove files programmatically in Python. Removing files, in this context, is the act of deleting or erasing files from a computer's file system using Python programming language. You must know that when you remove a file, it is permanently deleted from the ... Read More

How to remove a directory recursively using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 20-Jul-2023 13:08:41

4K+ Views

There are times when scenarios arise where you need to delete a directory and all its contents, including subdirectories and files, in the domain of Python programming. Such an operation as above is known as removing a directory recursively. Python makes available a powerful module called shutil that makes it ... Read More

How to open new pseudo-terminal pair using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 20-Jul-2023 13:05:33

467 Views

In the realm of Python programming, there arise times and scenarios where we need to interact and work with a terminal environment programmatically. Whether it is required to automate terminal-based tasks or to simulate user input, having the ability and skill to successfully create a new pseudo-terminal pair can be ... Read More

How to get the system configuration information relevant to an open file using Python?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 20-Jul-2023 13:02:17

182 Views

In the realm of Python programming, accessing system configuration information relevant to open files can be very useful in providing valuable insights into the operating environment. It does not matter if you are a curious developer or an avid enthusiast, this article will show you the way through the process ... Read More

Advertisements