标签:计算 end app name iterable 剖析 个数 iter bsp
append 追加
1 name_list=["eirc","alex","tony"] 2 name_list.append(‘seven‘) 3 print(name_list) 4 #输出结果[‘eirc‘, ‘alex‘, ‘tony‘, ‘seven‘]
count 计算个数
1 name_list=["eirc","alex","tony"] 2 name_list.append(‘seven‘) 3 name_list.append(‘seven‘) 4 name_list.append(‘seven‘) 5 name_list.append(‘seven‘) 6 print(name_list.count(‘seven‘)) 7 8 #输出结果 4
extent 扩展
# iterable 可迭代的
1 name_list=["eirc","alex","tony"] 2 name_list.append(‘seven‘) 3 name_list.append(‘seven‘) 4 name_list.append(‘seven‘) 5 name_list.append(‘seven‘) 6 print(name_list.count(‘seven‘)) 7 temp=[111,222,33,44] 8 name_list.extend(temp) 9 print(name_list)
#输出结果
4
[‘eirc‘, ‘alex‘, ‘tony‘, ‘seven‘, ‘seven‘, ‘seven‘, ‘seven‘, 111, 222, 33, 44]
标签:计算 end app name iterable 剖析 个数 iter bsp
原文地址:https://www.cnblogs.com/zyqy/p/9241105.html