Re: Nested List question

2016-02-24 Thread grsmith
Erik, Works perfectly, thanks much !!! Mark, I am tied to data structure. for address in addresses: if isinstance(address, str): apt = None print(address, apt) else: address, apt = address print(address, apt) 99 First Street None 33 Broadway Avenue Apt 303 1 P

Nested List question

2016-02-24 Thread grsmith
All, Can you have a phython list like: ['George', 'Soros', ['99 First Street', '33 Broadway Avenue', ['Apt 303'], '1 Park Avenue'], 'New York', 'NY'] In other words how do you correctly nest the ['Apt 303'] so it goes with 33 Broadway Avenue. Also, I tried several ways and could not figure

Re: Question on keyword arguments

2016-02-18 Thread grsmith
Thanks to all who responded, it is a big help. Tim, the 'crazy-other-result format' is the result returned by the database, nothing I can do about that :) Thanks again George -Original Message- From: Chris Angelico Sent: Thursday, February 18, 2016 10:45 AM Cc: python-list@python.or

Question on keyword arguments

2016-02-18 Thread grsmith
Would this be the correct way to return a list as a default result. Also, would the list be the preferable result (to a python programmer) ? def test(command, return_type='LIST'): """ Go to database and return data""" if return_type == 'LIST': result = ['ONE', 'TWO', 'THREE']