📜  python 附加几个值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:02.554000             🧑  作者: Mango

代码示例1
my_list.extend(iterable) # values in iterable will be appended to list

nums = []
nums.extend(range(5)) #using range()
nums.extend([5,6,7]) # using list
nums.extend((8,9,10)) # using tuple

print(nums) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]