How can I make a loop that eliminates zeroes from a list of strings that looks something like the following?
List
GR0030
GR00000000013
GR093
I'd like to eliminate the zeroes between the GR and the first number different than zero. I've thought I could solve this problem with something like this:
entry = ""
for x in list:
if x.isalpha():
entry = entry + x
else:
if x == 0:
entry = entry
else:
entry = entry + x[(list.index(x)):-1]
break
list1.append(entry) # the answer list
But, it does not work. I'm just getting a list full of GR in each row. What am I doing wrong?