通过索引,重新赋值
service=['http','firewalld','ssh','ftp']
service[0]='mysql'
print(service)
通过切片赋值
service=['http','firewalld','ssh','ftp']
service[:2]=['samba','dns']
print(service)
通过索引,重新赋值
service=['http','firewalld','ssh','ftp']
service[0]='mysql'
print(service)
通过切片赋值
service=['http','firewalld','ssh','ftp']
service[:2]=['samba','dns']
print(service)