×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2011
    Location
    Lagos, Nigeria
    Posts
    2

    Python on Symbian

    I am reading Python on Symbian on the wiki page of this site:
    http://wiki.forum.nokia.com/index.ph..._and_Messaging

    while reading, I came across this code within the body of a long code and I don't seem to understand what it does. I know what a try and except does but what the try line is set to fetch is completely unknown to me.

    try:
    noteString = '\n'.join(note.value for note in contactList[0].find(type='note'))
    except:
    noteString = u"No notes available"
    else:
    noteString = u"The phone number was not found"

    Could anyone please help me with the explanations please.
    thank you.

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Python on Symbian

    (1) contactList is a list of contacts returned as a result of the search.
    (2) contactList[0].find(type='note') returns a list of the fields of type note from the first contact in (1).
    '\n'.join(note.value for note in contactList[0].find(type='note')) means this: concatenate the values of the elements in (2) but put the '\n' character between them.

Similar Threads

  1. Replies: 2
    Last Post: 2011-01-17, 08:06
  2. Symbian C++ & Python
    By shery_89 in forum Symbian
    Replies: 2
    Last Post: 2010-04-01, 00:52
  3. Replies: 11
    Last Post: 2009-01-03, 20:25
  4. Symbian C++,python
    By vrunda pandya in forum Symbian
    Replies: 3
    Last Post: 2008-09-22, 18:27
  5. Python on S60 (GPS, camera, UI). Python or C
    By N800Fun in forum Symbian
    Replies: 13
    Last Post: 2008-09-16, 09:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×