Dec-14-2023, 01:29 AM
if sep is not given when calling str.split(), it combines runs of white-space as a single separator. if sep is given, then each character is a separator and empty strings can result when there are runs of the same character.
what i am looking for (to avoid implementing this) is a split() (and rsplit() variant) that can group runs of the same specified separator string together as a single separator. i will be doing this from back to front so i will be wanting an rsplit() variant of it.
for example, calling it gsplit:
what i am looking for (to avoid implementing this) is a split() (and rsplit() variant) that can group runs of the same specified separator string together as a single separator. i will be doing this from back to front so i will be wanting an rsplit() variant of it.
for example, calling it gsplit:
foo = '/usr///bin///bar' bar = whatever.gsplit(foo,'/') print(repr(bar))
Output:[ '','usr','bin','bar']
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.