You can do this in several ways:
The first way is using a list comprehension like the other answer does:
a = ['',18.0,'','',0,15,8.0]
b = [x if x != '' else 0 for x in a]
This reads like: 'Make an array b with each element x of a for which if x is not '' then put x, else put 0'.
There is also an awesome library called numpy which utilizes a syntax that looks like the syntax from Matlab you are referring to:
import numpy as np
a = ['',18.0,'','',0,15,8.0]
# Create a numpy array from the list
b = np.array(a)
b[b == ''] = 0
print(b)
>>> array(['0', '18.0', '0', '0', '0', '15', '8.0'],
dtype='<U4')
The array is now an array of strings, which you can convert to a float or something else using np.ndarray.astype(type)
.
Considering you've referred Matlab's syntax, I suggest having a look at numpy. When writing scripts in Python, you will notice numpy and Matlab share a lot of syntax.