向数组添加元素
向数组添加元素详细操作教程
以下实例为学习向数组添加元素,具体代码如下:
# Filename : example.py
# Author by : www.lidihuo.com
cars = ["Porsche", "Volvo", "BMW"]
cars.append("Audi")
print(cars)
执行以上代码输出结果为:
# Filename : example.py
# Author by : www.lidihuo.com
['Porsche', 'Volvo', 'BMW', 'Audi']