aboutsummaryrefslogtreecommitdiff
path: root/examples/list_people.py
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@google.com>2015-07-20 14:34:27 -0700
committerJan Tattermusch <jtattermusch@google.com>2015-07-20 14:34:27 -0700
commitb95670f5fb91ec49735510a5202e9c031d8f43f1 (patch)
treeb5de5cab748078bddd36c9805f78c25f1b26eaaa /examples/list_people.py
parent78709f20fb7255c3209e7126f404935bcf73e8dc (diff)
downloadprotobuf-b95670f5fb91ec49735510a5202e9c031d8f43f1.tar.gz
protobuf-b95670f5fb91ec49735510a5202e9c031d8f43f1.tar.bz2
protobuf-b95670f5fb91ec49735510a5202e9c031d8f43f1.zip
fix python example
Diffstat (limited to 'examples/list_people.py')
-rwxr-xr-xexamples/list_people.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/list_people.py b/examples/list_people.py
index d470349a..e0658493 100755
--- a/examples/list_people.py
+++ b/examples/list_people.py
@@ -7,13 +7,13 @@ import sys
# Iterates though all people in the AddressBook and prints info about them.
def ListPeople(address_book):
- for person in address_book.person:
+ for person in address_book.persons:
print "Person ID:", person.id
print " Name:", person.name
- if person.HasField('email'):
+ if person.email != "":
print " E-mail address:", person.email
- for phone_number in person.phone:
+ for phone_number in person.phones:
if phone_number.type == addressbook_pb2.Person.MOBILE:
print " Mobile phone #:",
elif phone_number.type == addressbook_pb2.Person.HOME: