list as parameter for the split function
29 Sep
2015
29 Sep
'15
1:10 a.m.
Hello everyone, I was wondering how to split a string with multiple separators. For instance, if I edit some subtitle file and I want the string '00:02:34,452 --> 00:02:37,927' to become ['00', '02', '34', '452', '00', '02', '37', '927'] I have to use split too much time and I didn't find a "clean" way to do it. I imagined the split function with an iterator as parameter. The string would be split each time its substring is in the iterator. Here is the syntax I considered for this :
'00:02:34,452 --> 00:02:37,927'.split([ ':', ' --> ', ',' ]) ['00', '02', '34', '452', '00', '02', '37', '927']
Is it a relevant idea ? What do you think about it ? Regards, Niilos.
3103
Age (days ago)
3104
Last active (days ago)
9 comments
9 participants
participants (9)
-
Andrew Barnert
-
Chris Angelico
-
Chris Barker
-
Emile van Sebille
-
Mike Miller
-
Niilos
-
Paul Moore
-
Ryan Gonzalez
-
Steven D'Aprano