lst = ['123,456', '"hello"', '345,678', '"bye"']
def main():
new_lst = []
for item in lst:
#print item
new_lst.append(item.replace(',','***'))
new_lst.append(item.replace('\"', ''))
return new_lst
print main()
This is quite puzzling to me. I don't know what I'm doing wrong here. I know it's a very stupid mistake but it's not clicking for me. I don't know why I get an output of:
['123***456', '123,456', '"hello"', 'hello', '345***678', '345,678', '"bye"', 'bye']
What I was hoping was for:
['123***456', 'hello', '345***678', 'bye']
Any help is greatly appreciated!