Sarika Singh has Published 72 Articles

Data Hiding in Python

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 12:28:53

4K+ Views

Data hiding is also known as data encapsulation and it is the process of hiding the implementation of specific parts of the application from the user. Data hiding combines members of class thereby restricting direct access to the members of the class. Data hiding plays a major role in making ... Read More

How to create a tar file using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 12:09:00

10K+ Views

Tape Archive Files is what the letter TAR in tar files stands for. Tar files are the archive files which allows you to store numerous files in a single file. Open-source software is distributed using tar files. Tar files typically end in.tar, but after they've been compressed using tools like ... Read More

How to print characters from a string starting from 3rd to 5th in Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 11:50:52

8K+ 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, characters can therefore be retrieved from 0 to n-1. For instance, the index of the text ... Read More

How to iterate through a dictionary in Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 11:42:27

10K+ Views

Dictionaries are a valuable and frequently used data structure in Python. This article tells us how to traverse through a dictionary while performing operations on its key-value pairs. Using dict.items() Method Python's dict.items() method allows you to loop through the dictionary. Each repetition will provide you with both the key ... Read More

How to check file last access time using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 08:29:35

2K+ Views

The file last access datetime in Python can be obtained in a number of different ways. The following OS module methods will be used to obtain the file last access time in Python. Using os.path.getatime() Method In Python, we can use the os.path.getatime() method to retrieve a path's most recent ... Read More

How to merge multiple files into a new file using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 08:00:00

11K+ Views

Python makes it simple to create new files, read existing files, append data, or replace data in existing files. With the aid of a few open-source and third-party libraries, it can manage practically all of the file types that are currently supported. We must iterate through all the necessary files, ... Read More

How to check if a file exists or not using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 07:56:56

743 Views

You might wish to perform a specific action in a Python script only if a file or directory is present or not. For instance, you might wish to read from or write to a configuration file, or only create the file if it doesn't already exist There are many different ... Read More

How to change the owner of a directory using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 07:43:20

3K+ Views

By utilising the pwd, grp, and os modules, you can modify the owner of a file or directory. To obtain the user ID from the user name, to obtain the group ID from the group name string, and to modify the owner, one uses the uid module. Following are the ... Read More

How to change the permission of a file using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 07:28:49

16K+ Views

The user whose actions are allowed on a file are governed by its file permissions. A file's permissions for reading, writing, and executing are modified when the file's permissions are changed. This article will cover how to change a file's permission in Python. Using os.chmod() Method To modify the permissions ... Read More

How to move a file from one folder to another using Python?

Sarika Singh

Sarika Singh

Updated on 18-Aug-2022 07:08:24

6K+ Views

The Python shutil module provides a number of functions for high-level operations on individual files and file collections. We could move a file from one folder to another. You can accomplish this in a number of ways. Using OS Module The Python OS module gives users the ability to create ... Read More

Advertisements