“with” statement in Python to Open a file

A common way to work with files in Python is to create file handler with “open” statement and work with the file. After finishing the work with the file, we need to close the file handler with close statement. For example, if we want to read all lines of a file using Python , we use… Continue reading “with” statement in Python to Open a file