标签:lambda i+1 总计 字符 app lemp 去除 pop map
def expandstr(mylist):
if isinstance(mylist[-1],str):
mylist.append(0.00)
indexlist = []
i=0
while i<len(mylist)-1:
myval = mylist[i]
if isinstance(mylist[i+1], str) and isinstance(myval, str):
indexlist.append(i)
else:
print("hi")
i+=1
indexlist=list(map(lambda x:x+1,indexlist))
mylist.insert(indexlist[0],0.00)
i=1
while i<len(indexlist):
mylist.insert(indexlist[i]+1,0.00)
i+=1
print("expand: ",indexlist)
print("expand: ",mylist)
saiwa=[‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘每吨人工:‘, ‘‘, 90.0, ‘‘, ‘‘, ‘总人工‘, 1748.07, ‘‘, ‘‘] print(len(‘‘)) def delempty(mylist): if ‘‘ in mylist: mylist.pop(mylist.index(‘‘)) delempty(mylist) return mylist saiwa=delempty(saiwa) print(‘finally:‘,saiwa)
标签:lambda i+1 总计 字符 app lemp 去除 pop map
原文地址:https://www.cnblogs.com/saintdingspage/p/11372405.html