my_list = [['abcdefg','awdawdawd'],['awdwer'],[],'rtgerfwed','wederfrtg']]
所以我有一个列表,我想找到列表中每个子列表的平均长度
我试过了,但它似乎没有用
lengths = []
lengths = my_list
for k in lengths:
k = len(k)
print lengths
# i get this again -> [['abcdefg','awdawdawd'],['awdwer'],[],'rtgerfwed','wederfrtg']]
我希望输出是
lengths = [8,6,0,9]