python里列表中含有多个空字符串",有什么办法能找到空字符串的索引位置,并将空字符串转换为'0'
python里列表中含有多个空字符串",有什么办法能找到空字符串的索引位置,并将空字符串转换为'0'
收起
循环列表逐个元素判断即可
代码如下:(如有帮助,望采纳!谢谢! 点击我这个回答右上方的【采纳】按钮)
lst = ["a","","b","c","","","d",""]
for i,v in enumerate(lst):
if v=="":
print(i)
lst[i] = "0"
print(lst)
报告相同问题?