I have data naively collected from package dependency lists.
Depends: foo bar baz >= 5.2
I end up with
d = set([\'foo\',\'bar\',\'baz\',\'
How about
d = set([item for item in d if re.match("^[a-zA-Z]+$",item)])
that gives you just the values you want, back in d (the order may be different, but that's the price you pay for using sets.