I am trying to remove all the prefix "@" from the string "@@@@b@@" Expected output is "b@@" (not all the '@' but only prefix) If there is no prefix "@", it should return the original string itself This is the code, I am trying : (I am using python 2.X)
mylist = []
def remove(S):
mylist.append(S)
j=0
for i in range(len(S)):
if mylist[0][j]=='@':
S = S[:j] + S[j + 1:]
j+=1
return S
else:
return S
break
a = remove("@@@@b@@")
print a