On 5/5/2016 1:39 AM, Stephen Hansen wrote:
pattern = re.compile(r"^[A-Z\s&]+$")
output = [x for x in list if pattern.match(x)]
Holy Shr"^[A-Z\s&]+$" One line of parsing! I was figuring a few list comprehensions would do it - this is better. (note: the reason I specified 'spaces around ampersand' is so it would remove 'Q&A' if that ever came up - but some people write 'Q & A', so I'll live with that exception, or try to tweak it myself. You're the man, man. Thank you! -- https://mail.python.org/mailman/listinfo/python-list