What is file context manager?



What is file context manager?..

Answer / Pushpendra Chaturvedi

In Python, a context manager is an object that defines a special method called __enter__() and __exit__(). A file object (like open()) can act as a context manager to ensure proper file handling such as automatic opening and closing of files.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Is there any tool used to find bugs or carrying out static analysis?

1 Answers  


Python documentation is called?

1 Answers  


Which data type you prefer to implement when deal with seuential data?

1 Answers  


Tell me what is the difference between list and tuple?

1 Answers  


What are the modes to open a file in python?

1 Answers  


Why is python weakly typed?

1 Answers  


What is the dogpile effect?

1 Answers  


How to send an email in python language?

1 Answers  


What is r regex?

1 Answers  


What is the difference between old style and new style classes in python?

1 Answers  


Can I learn python without knowing html?

1 Answers  


Is there a constructor in python?

1 Answers  


Categories