Re: Nested List question

2016-02-24 Thread grsmith
Park Avenue None -Original Message- From: Erik Sent: Wednesday, February 24, 2016 4:28 PM To: grsm...@atlanticbb.net ; python-list Subject: Re: Nested List question On 24/02/16 20:59, grsm...@atlanticbb.net wrote: Can you have a phython list like: ['George', 'Soros'

Re: Nested List question

2016-02-24 Thread Mark Lawrence
On 24/02/2016 20:59, grsm...@atlanticbb.net wrote: 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

Re: Nested List question

2016-02-24 Thread Erik
On 24/02/16 20:59, grsm...@atlanticbb.net wrote: 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.

Re: Nested List question

2016-02-24 Thread Andrew Farrell
you can indeed have a nested list. One way you could do that looks like donor = [ 'George', 'Soros', [ #<- 2nd element of outermost list '99 First Street', [ #<- 1st element of middling list '33 Broadway Av

Re: Nested List question

2016-02-24 Thread Grant Edwards
On 2016-02-24, wrote: > All, > > Can you have a phython list like: > ['George', > 'Soros', > ['99 First Street', > '33 Broadway Avenue', ['Apt 303'], > '1 Park Avenue'], > 'New York', 'NY'] Sure: $ python3 Python 3.4.3 (default, Feb 12 2016, 15:58:12) [GCC 4.9.3] on linux Type "help", "c

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: Pychecker Re: Nested List Question

2005-11-02 Thread Mike Meyer
Roman Suzi <[EMAIL PROTECTED]> writes: > On Thu, 3 Nov 2005, Chris McCoy wrote: >>> gridSystemId = [[None]*columns]*rows >> You've made gridSystemID a list of `rows` references to the SAME "inner" >> list, so the behavior you observe is the only possible one. >> If you want copies instead, ASK for

Re: Nested List Question

2005-11-02 Thread Fredrik Lundh
"Newsfeeds" <[EMAIL PROTECTED]> wrote: > Could anyone tell me why this code produces the output it does? http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list has the full story. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pychecker Re: Nested List Question

2005-11-02 Thread Chris McCoy
It may, but I haven't been using Pychecker yet. I'm still fairly new to Python. Thanks, Chris M. "Roman Suzi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 3 Nov 2005, Chris McCoy wrote: > >> Thank you! I've been banging my head against the wall! >> >> Chris M. > >>> g

Pychecker Re: Nested List Question

2005-11-02 Thread Roman Suzi
On Thu, 3 Nov 2005, Chris McCoy wrote: > Thank you! I've been banging my head against the wall! > > Chris M. >> gridSystemId = [[None]*columns]*rows > > You've made gridSystemID a list of `rows` references to the SAME "inner" > list, so the behavior you observe is the only possible one. > > If y

Re: Nested List Question

2005-11-02 Thread Chris McCoy
Thank you! I've been banging my head against the wall! Chris M. "Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Newsfeeds <[EMAIL PROTECTED]> wrote: > >> Hello All, >> >> Could anyone tell me why this code produces the output it does? > ... >> gridSystemId = [[

Re: Nested List Question

2005-11-02 Thread Alex Martelli
Newsfeeds <[EMAIL PROTECTED]> wrote: > Hello All, > > Could anyone tell me why this code produces the output it does? ... > gridSystemId = [[None]*columns]*rows You've made gridSystemID a list of `rows` references to the SAME "inner" list, so the behavior you observe is the only possible on

Nested List Question

2005-11-02 Thread Newsfeeds
Hello All, Could anyone tell me why this code produces the output it does? noAdjacencies = 2 gridsPerAdj = 3 rows = 4 columns = 5 gridSystemId = [[None]*columns]*rows for row in range(rows): for column in range(columns): gridSystemId[row][column] = "%d-%d" % (row,column) print gr