li = ['a', 'b', 'c'] li.extend(['d', 'e', 'f']) print li print len(li) print li[-1] li = ['a', 'b', 'c'] li.append(['d', 'e', 'f']) print li print len(li) print li[-1]
运行结果如下:
['a', 'b', 'c', 'd', 'e', 'f'] 6 f ['a', 'b', 'c', ['d', 'e', 'f']] 4 ['d', 'e', 'f']
希望本文所述对大家的Python程序设计有所帮助。
Copyright © 2019- huatuo7.cn 版权所有 湘ICP备2022005869号-9
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务