python 列表(元组)之间的累加和乘法

python yekong 1438℃

累加

names = ['xiaoming', 'xiaoliang', 'xiaozhang']
news_names = names + names
print(news_names)
结果
['xiaoming', 'xiaoliang', 'xiaozhang', 'xiaoming', 'xiaoliang', 'xiaozhang']

乘法

names = ['xiaoming', 'xiaoliang', 'xiaozhang']
news_names2 = names * 3
print(news_names2)
结果
['xiaoming', 'xiaoliang', 'xiaozhang', 'xiaoming', 'xiaoliang', 'xiaozhang', 'xiaoming', 'xiaoliang', 'xiaozhang']

喜欢 (1)