1
Good afternoon staff, developing a code, I came across a question: I would like to realize a split()
with n
conditions? Or any efficient way to do?
For example:
I am requesting for a user to enter some information through a input()
, but I would like to carry out the split()
so much if he uses ,
or .
how much also to use /
or -
.
I know it doesn’t work, since the documentation is presenting this hierarchy str.split(sep=None, maxsplit=-1)
, I was thinking of something functional that looked like:
information_list = list(input('Enter the informations: ').split(',', '.', '/', '-'))
As a return, I wish to have a list of the values that the user typed separated by the 'arguments' I mentioned above. However, if you have other methods to indicate in order to accomplish something similar, it would also be of great value.
Thank you for your attention Giovanni.
– user89389