Matt wrote:

> What is easiest way to determine if a string ONLY contains a-z upper
> or lowercase.  I also want to allow the "-" and "_" symbols.  No
> spaces or anything else.

If you don't know regular expressions here's a method where not much can go 
wrong:

>>> import string
>>> acceptable = frozenset(string.ascii_letters + "_-").issuperset
>>> acceptable("Foo-Bar")
True
>>> acceptable("Foo-Bar42")
False
>>> acceptable("Foo Bar")
False
>>> acceptable(string.ascii_letters + "_-")
True


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

Reply via email to