Explain the concept of context managers in Python and provide an example of how they can be used to manage resources efficiently.
Context managers help manage resources efficiently, like file handling using with statement. Here's a file handling example:
with open("example.txt", "r") as file:
data = file.read()
# Do something with the data
# File is automatically closed outside the 'with' block