k...@fiber-space.de wrote:

> ttable   = string.maketrans("{} ", "\1\1\1")
> print x.translate(ttable).split("\1")   # -> ['', 'ABC', 'EFG', 'IJK',
> 'LMN', 'OPQ', '']
> 
> The validity of the translation+split depends on the presence of \1 in
> the original string of course.

Keep one of the splitting characters to avoid that (theoretical) risk:

ttable = string.maketrans("{} ", "{{{")

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to