Nico Grubert wrote:

> I'd like to split a string where 'and', 'or', 'and not' occurs.
> Example string:
> s = 'Smith, R. OR White OR Blue, T. AND Black AND Red AND NOT Green'

Here is a solution without using the re module:
s.replace(' AND NOT ', ' OR ').replace(' AND ', ' OR ').split(' OR ')

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

Reply via email to