python中的extend
extend()拓展列表,批量写入
举个例子:
1 a = ["hello", "world", "dlrb"]
2 b = [1, 2, 3,]
3 a.extend(b)
4 print(a)
输出结果:
['hello', 'world', 'dlrb', 1, 2, 3]
我们通过extend将列表b的元素全部写入到列表a中
posted on
2019-04-09 10:07
恒笛 阅读(
...) 评论(
)
编辑
收藏
转载于:https://www.cnblogs.com/xwqhl/p/10675176.html