Re: Test String Contents

2017-06-13 Thread Peter Otten
Peter Otten wrote: > 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: ...

Re: Test String Contents

2017-06-13 Thread Thomas Nyberg
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.repl

Re: Test String Contents

2017-06-13 Thread Peter Otten
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 =

Test String Contents

2017-06-13 Thread Matt
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. -- https://mail.python.org/mailman/listinfo/python-list