
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 10482 Articles for Python

13K+ Views
In Python file handling, there are several functions and methods that have different functionalities and are used to achieve specific purposes and tasks. Among such kind as above, the seek() method makes it possible for you to reset the read/write position within a file. This functionality of the method is very helpful when you need to move the cursor to a specific or particular location in the file to carry out subsequent read or write operations. In this article, we will examine several ways how you can make use of the seek() method to reset the read/write position in Python. ... Read More

4K+ Views
As a part of file handling operations, in Python, you can carry out the operation of setting the read and write positions within a file to access or modify specific parts of its content. This functionality permits you to navigate and explore through the file performing various operations at desired locations. Through the medium of this article, we will learn to master the operation of setting the read and write positions in a file using Python. You can always follow the descriptive and detailed explanations and code examples given below to understand and gain the skill of positioning within a ... Read More

17K+ Views
In Python, file handling is a big topic spanning several scores of operations; one such operation is one of reading the first line of a file and this allows you to quickly access and retrieve specific information without reading the entire file. In this present article, we will examine several ways of executing the process of reading only the first line of a file using Python. You can follow the lucid and descriptive explanations and code examples below to understand and master the process of reading the first line of a file. Using the readline() Method To be ... Read More

838 Views
In Python, file handling involves many operations; among them, one such task is opening a file for reading and this makes it possible for you to access and retrieve data from the file. In this article, we will discuss and learn how to open a file in read mode using Python; we will use some code examples with self-explanatory descriptions to help you understand and master the process of reading files in Python. Opening a File for Reading and Printing its Content For a file to be opened for reading and printing its content, you can follow these steps: ... Read More

1K+ Views
In Python, in the domain of file handling, we come across several different types of operations; one such operation is that of opening a file for writing; this operation allows you to either create a new file or overwrite the existing content with fresh data. In this article, here, we will go through several ways on how to open a file in write mode using Python. To make it easy to understand and learn we provide for several code examples below with stepwise explanations to help master the process of writing files in Python. Opening a File in Write Mode ... Read More

16K+ Views
The task of appending content to a file is a common and routine task in Python programming. If you need to log data, store user inputs, or update a configuration file, appending makes it possible for you to add new data or information to a file without overwriting existing content. Here, in this article, we will explore various ways of how to append to a file using Python; we also demonstrate through some code examples with explanations to guide you through the process. You will get to know how to append content to a file using Python in many different ... Read More

14K+ Views
File handling in Python, among others, involves the task of opening a file in append mode which has its own importance in that scheme of things. Append mode makes it possible for you to add new content to a file without deleting or overwriting the existing data. Here, in this article, we will explore several different ways how you can open a file in append mode using Python; we make provision for some code examples with easy-to-follow detailed stepwise explanations. Opening a File in Append Mode for Text Writing In order to open a file in append mode for writing ... Read More

393 Views
Python 3.0 was released in December 2008. It was designed to rectify certain flaws in earlier versions. Python 3.0 doesn’t provide backward compatibility. That means a Python program written using version 2.x syntax doesn’t execute under the Python 3.x interpreter. Version 2.7 is the final major release in the Python 2.x series. The guiding principle of Python 3 was: "reduce feature duplication by removing old ways of doing things". Although there are quite a few differences in usage of these two versions, the most obvious ones are mentioned below - Print Statement Vs Function print is a keyword in Python ... Read More

2K+ Views
Binary file is a file that consists of a series of 1's and 0's. This is typically used to represent data such as images, audio, video, etc. To open the binary files in read and write mode, Python provides an in-built function, which is the open() function. The open() Function The Python open() function is a built-in function that is used to open a file. This method accepts a string value representing a file path (or, name) as a parameter and returns the object of the specified file. In addition to the file path, we can also pass another parameter named ... Read More

2K+ Views
In Python, you can open a file for both reading and writing using the built-in open() function. This is essential when you want to manipulate a file's content without needing to close and reopen it repeatedly. This mode allows us to read from and write to the file simultaneously, but it will raise an error if the file does not exist. We can also use Write and Read (w+) mode, which will truncate the file. Opening a File in Read and Write Mode To open a file for reading and writing, you can use the Read and Write Mode ('r+'). ... Read More