python字典和数组修改

test_zidian = {
'1':"张三",
'2':"李四",
'3':"王五",
'4':"四个",
}
test_zidian['5'] = "五大" 增加
test_zidian['5'] = "五大已被修改" 修改
test_zidian.pop('5')
del test_zidian['4'] 删除
test_zidian.get['3'] 查找

test_sz = ['a','b','c','d']
test_sz.append('e') 增加
test_sz[4] = 'eeee' 修改
test_sz.remove('d') 删除
test_sz.insert[4] = 'abc'
test_sz.insert(4,'abc') 插入
test_sz.index('abc',0,-1) 查找abc的序列位置
del test_sz[3] 删除

猜你喜欢

转载自www.cnblogs.com/liangliang2020/p/9063923.html