I have a python list called Headings:
Headings = ['Doug', None, None, None, None, 1234, None, None, 'Mike', None]
I want to get is so the None
values are replaced with the String or Number that precedes and is the the closest to the None
value like this:
Headings=['Doug', 'Doug', 'Doug', 'Doug', 'Doug', 1234, 1234, 1234, 'Mike', 'Mike']
How do I do so?
Also with the initial Headings List..
Headings = ['Doug', None, None, None, None, 1234, None, None, 'Mike', None]
How to I get an index of where a string or number starts and where it ends?
For example I need index of where 'Doug'
is and the index of the None
that precedes 1234.
Likewise I need the index where 1234 is and the index of the last None before 'Mike'
.