访问元组示例【每日一个知识点第322期-Python】
访问元组
tup1 = ('physics', 'chemistry', 1997, 2000); #tup1[0]: physics print "tup1[0]: ", tup1[0] #tup1[1:5]: ('chemistry', 1997) print "tup1[1:5]: ", tup1[1:3]
访问元组
tup1 = ('physics', 'chemistry', 1997, 2000); #tup1[0]: physics print "tup1[0]: ", tup1[0] #tup1[1:5]: ('chemistry', 1997) print "tup1[1:5]: ", tup1[1:3]