you need to check it against str
l[0]!= '0': # do something else: # do something eseor
if l[0].startswith('0'): # do something if it start with 0 else: # do something elsenote that your code has other problems too - e.g. there could be case when b is not defined on line #23 to name one...