list1 = ['a', 'b', 'c', 'a']
tuple1 = ('a', 'b', 'c', 'a')
计算list1或者tuple1中元素的个数: count_a = list1.count('a') count_a = tuple1.count('a')
计算list1或者tuple1中元素的下标:(只能计算出出现的元素的第一个下标) : index_a = list1.index('a') index_a = tuple1.index('a')
list1 = ['a', 'b', 'c', 'a']
tuple1 = ('a', 'b', 'c', 'a')
计算list1或者tuple1中元素的个数: count_a = list1.count('a') count_a = tuple1.count('a')
计算list1或者tuple1中元素的下标:(只能计算出出现的元素的第一个下标) : index_a = list1.index('a') index_a = tuple1.index('a')