1 # 元组也是list,但不能修改,通过下标取值 2 t = ('127.0.0.1','root','123456',3306) 3 t.count('root') 4 t.index('root') 5 print(t.count('root')) 6 print(t.index('root'))