python的元祖使用一对小括号表示的,元素是固定的,如果希望添加新的元素,可以先将元祖转换成数组列表,再进行操作
colour_tuple = ("Red","Green","Blue") colour_list = list(colour_tuple) assert colour_list == ["Red","Green","Blue"]
python的元祖使用一对小括号表示的,元素是固定的,如果希望添加新的元素,可以先将元祖转换成数组列表,再进行操作
colour_tuple = ("Red","Green","Blue") colour_list = list(colour_tuple) assert colour_list == ["Red","Green","Blue"]