diff options
Diffstat (limited to 'examples/list_people.py')
-rwxr-xr-x | examples/list_people.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/list_people.py b/examples/list_people.py index 755de901..f131872d 100755 --- a/examples/list_people.py +++ b/examples/list_people.py @@ -31,8 +31,7 @@ if len(sys.argv) != 2: address_book = addressbook_pb2.AddressBook() # Read the existing address book. -f = open(sys.argv[1], "rb") -address_book.ParseFromString(f.read()) -f.close() +with open(sys.argv[1], "rb") as f: + address_book.ParseFromString(f.read()) ListPeople(address_book) |