I have the following words in a list
listx=['info/base','tri-gen']
I am trying to remove both the '/' and '-' at the same time.
Currently I have two separate blocks of code (mentioned below) which achieve the above
listx=['info/base','tri-gen']
if '/' in listx:
listmain= '/'.join(listx).split('/')
listmain = list(filter(None, listmain))
if '-' in listx:
listmain= '-'.join(listx).split('-')
listmain = list(filter(None, listmain))
How do I achieve it in a single if condition or is there a way to include many conditions for e.g like below
'-','/'.join(listx).split('-','/')
Expected output
listx=['info base','tri gen']