I was looking for the same info but in Python. I was able to get the
answer by the hints here, so I'm posting what i found in case others
find it helpful. In the following example, I make my phone loop also
enumerate i. I use this number to delete the phone number where i = 3
(the 4th phone number in the list since it's 0-indexed). Note,
however, that when the "remove(phone)" function is called, it is in
deed passed an object of type entry.phone_number, not an int as in the
Java example. behind the scenes, the data structure is a Python
"list", so data can be removed accordingly
for i, phone in enumerate(entry.phone_number):
if i == 3:
entry.phone_number.remove(phone);
self.gd_client.UpdateContact(entry.GetEditLink().href,
entry)
enjoy!
On Aug 19, 11:59 am, NMAGOCIO <[email protected]> wrote:
> Similarly you can list the phone, emails, etc:
>
> for (int ii = 0; ii< entry.getPhoneNumbers().size(); ii++) {
> PhoneNumber phoneNumber = entry.getPhoneNumbers().get(ii);
> String[] relSplit = phoneNumber.getRel().split("#");
> System.out.println("Phone " + ii + ": \t" +
> phoneNumber.getPhoneNumber() + "\t" + relSplit[1]);
> }
>
> will give you
> Phone 0: 555-5555 work
> Phone 1: 555-1111 mobile
>
> Now that you know the location of the phone in the list
>
> // Delete Phone
> int locDel = 0;
> System.out.print("\nPlease enter number of the phone to delete
> ");
> locDel = Integer.parseInt(dataIn.readLine());
> entry.getPhoneNumbers().remove(locDel);
> entry.update();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---