Sarika Singh has Published 137 Articles

Data Hiding in Python

Sarika Singh

Sarika Singh

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

7K+ 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 merge multiple files into a new file using Python?

Sarika Singh

Sarika Singh

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

14K+ 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

1K+ 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

4K+ 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

22K+ 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 compare two different files line by line in Python?

Sarika Singh

Sarika Singh

Updated on 17-Aug-2022 13:56:40

12K+ Views

This tutorial looks at various Python comparison techniques for two files. We'll go over how to perform this typical work by using the available modules, reading two files, and comparing them line by line. In Python, comparing two files can be done in a variety of ways. Comparing Two Text ... Read More

Can we explicitly define datatype in a Python Function?

Sarika Singh

Sarika Singh

Updated on 13-Feb-2020 06:27:43

900 Views

Yes, in Python, you can explicitly define the datatype of function parameters and return values using type hints or type annotations. Even if you specify the data types using type hints, Python will still run the code even when the wrong types are passed. The execution of the program will ... Read More

Advertisements