List assignment, unexpected result

Steve Coates steve.coates at virgin.net
Wed Jul 10 17:33:02 EDT 2002


Thanks for the help. I think my favourite solution was

grid = [['.' * 4] for i in range(4)]

but I'll need to read up on the syntax. I haven't seen this
use of a for loop before.

Steve Coates





More information about the Python-list mailing list