标签:tcl index pytho googl int huawei 查询 根据 div
#!/usr/bin/env python3 # -*- coding: utf-8 -*- names = ["sony","xiaomi","huawei","apple","google"] print(names) print(names[0]) print(names[-1]) #查询最后1位 print(names[-2:]) #查询最后2位 #追加到最后 names.append("TCL") print(names) #增加,直接指定需要增加到哪个位置 names.insert(1,"alibaba") print(names) #修改 names[2]="mi" print(names) #删除 names.remove(names[2]) print(names) names.remove("TCL") print(names) #根据名称查询位置 print(names.index("apple")) print(names[names.index("apple")])
标签:tcl index pytho googl int huawei 查询 根据 div
原文地址:https://www.cnblogs.com/bfmeo/p/11643604.html