I need to take all the values in a list, and replace them with zeroes if they're a string or their actual number if they're an int. the w.replace is how I'll replace the string, but I don't know what to replace 0 with.
def safe_int(list):
list = [w.replace(, "0") for w in list]
list = [int(i) for i in list]
I want to replace "a" with zero and the entirety of "zebra" with zero inside the list_of_strings.
list_of_strings = ["a", "2", "7", "zebra" ]
The end output should be [0, 2, 7, 0]
list = [0 if isinstance(w, str) else int(w) for w in list_of_strings]?