def foo(): '''找到a开头的元素、组成新的列表''' src = ['abc','sac','des','yhg','acc'] new_list=[] for i in src: if i.startswith('a'): new_list.append(i) print(new_list) foo() #调用函数
def foo(): '''找到a开头的元素、组成新的列表''' src = ['abc','sac','des','yhg','acc'] new_list=[] for i in src: if i.startswith('a'): new_list.append(i) print(new_list) foo() #调用函数