On 06/13/2017 03:34 PM, 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. > I'm not sure it's the best way, but the following seems okay:
>>> s = 'hello_world' >>> s.replace('-','').replace('_','').isalpha() True >>> s = 'hello world' >>> s.replace('-','').replace('_','').isalpha() False >>> Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list