python列表list更新自身的值的写法

def formatPics(pics):
    pattern = r'>(?=((?!>).)*$)'
    altPattern = r'alt=[\"|\'].*?[\"|\']'
    stylePattern = r'style=[\"|\'].*?[\"|\']'
    i = 0
    for pic in pics:
        pic = re.sub(pattern, '/>', pic)
        pic = re.sub(altPattern, '', pic)
        # pic = re.sub(stylePattern, '', pic)
        pics[i] = pic
        i = i + 1
    return pics