write a program in a python to read the content of file and display I in place of used by displaying the content of file all other character should appear as it is
Answers
Explanation:
To work with stored data, file handling belongs to the core knowledge of every professional Python programmer. Right from its earliest release, both reading and writing data to files are built-in Python features. In comparison to other programming languages like C or Java it is pretty simple and only requires a few lines of code. Furthermore, no extra module has to be loaded to do that properly.
Basics of Files in Python
The common methods to operate with files are open() to open a file, seek() to set the file's current position at the given offset, and close() to close the file object when you're done using it. The open() method returns a file handle that represents a file object to be used to access the file for reading, writing, or appending.
When opening a file for reading, Python needs to know exactly how the file should be opened with the system. Two access modes are available - reading, and reading in binary mode. The respective flags used are r, and rb, and have to be specified when opening a file with the built-in open() method. The first mode includes the interpretation of special characters like "CR" (carriage return) and "LF" (linefeed) to represent line-breaks, whereas the binary mode allows you to read the data in raw mode - where the data is stored as is without further interpretation.