hi what is the difference between the two kinds of brackets? I tried a few examples but I can't make out any real difference: lst = [10, 20, 30] print lst[0] print lst[2] print lst lst = (10, 20, 30) print lst[0] print lst[2] print lst
lst = [10, 20, 40, "string", 302.234] print lst[0:2] print lst[:3] print lst[3:] lst = (10, 20, 40, "string", 302.234) print lst[0:2] print lst[:3] print lst[3:] 10 30 [10, 20, 30] 10 30 (10, 20, 30) [10, 20] [10, 20, 40] ['string', 302.23399999999998] (10, 20) (10, 20, 40) ('string', 302.23399999999998) Are these two kinds of brackets mean the same thing in the "list" context? Thanks. -- http://mail.python.org/mailman/listinfo/python-list