(1)索引
service = ['http','ssh','ftp']
print(service[0])
print(service[-1])
列表里嵌套列表
service2 = [['http','80'],['ssh','22'],['ftp','21']]
print(service2[0][1])#索引
(2)切片
service = ['http','ssh','ftp']
print(service[:-1])
print(service[::-1])
列表里嵌套列表
service2 = [['http','80'],['ssh','22'],['ftp','21']]
print(service2[:][1])
print(service2[:-1][0])
(3)重复
service = ['http','ssh','ftp']
print(service * 3)
(4)连接
service = ['http','ssh','ftp']
service1 = ['nfs','samba']
print(service + service1)
(5)成员操作符
service = ['http','ssh','ftp']
print('nfs' in service)
print('nfs' in service1)
(6)for循环遍历
service = ['http','ssh','ftp']
for i in service:
print(i)