['#', 'vcrisan', '#sses', '#crusu', 'ALL', '#rpavlicek', 'oracle', '#vcrisan', 'dwilks,skumar', 'sjoshi,skekes', 'skekes', 'sdammalapati', 'sdammalapati']
I am trying to remove string with # in the list and if the string is like 'dwilks,skumar' will split it again and add to the string again removing the old one.
The condition I am using is working but for single time only
for name in userslist:
if '#' in name:
userslist.remove(name)
if ',' in name:
newwlist=name.split(',')
userslist.remove(name)
for splittedname in newwlist:
userslist.append(splittedname)
print (userslist)
Result:
['vcrisan', '#crusu', 'ALL', 'oracle', 'dwilks,skumar', 'skekes', 'sdammalapati', 'sdammalapati', 'sjoshi', 'skekes']
It's working for the first two # hash and not for the third one similarly for the comma case it working for the second value sjoshi,skekes only
NOTE: Please donot recommend re module