编程语言
首页 > 编程语言> > python瞎练

python瞎练

作者:互联网

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)

 

标签:mylist,indexlist,python,0.00,瞎练,str,print,isinstance
来源: https://www.cnblogs.com/saintdingspage/p/11372405.html