True stands for 1 and False stands for 0 so list[True] is equivalent to list[1] and list[False] is equivalent to list[0]
On 7/5/07, kath <[EMAIL PROTECTED]> wrote:
Hi, Can any one please tell me how is the following code is working? ['a','b'] is a list of string, and [True] is list of boolean value. How is it making effect....? <code Python24> >>> ['a','b] [True] 'b' >>> ['a','b'] [False] 'a' >>> ['a','b']['some_string' == r'some_string'] 'b' >>> ['a','b']['some_string' == r'somestring'] 'a' <code> Thanks in advance, regards, kath. -- http://mail.python.org/mailman/listinfo/python-list
-- Regards-- Rishi Pathak National PARAM Supercomputing Facility Center for Development of Advanced Computing(C-DAC) Pune University Campus,Ganesh Khind Road Pune-Maharastra
-- http://mail.python.org/mailman/listinfo/python-list