Why use indexing at all - when you have
PS Recommended form to check type -
zip
?[val2 if val1 == 'null' else val1 for val1, val2 in zip(list1, list2)]
PS Recommended form to check type -
isinstance
if isinstance(value, int): .....
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.