On Fri, 24 Oct 2014 15:07:06 -0400, Seymore4Head wrote: > On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence > <breamore...@yahoo.co.uk> wrote: > >>On 24/10/2014 19:20, Seymore4Head wrote: >>> I meant to type: >>> if y in range(1,10) doesn't work. >>> Sigh Sorry >>> >>> >>How many more times, state what you expect to happen and what actually >>happens. "doesn't work" is useless. Please read this http://sscce.org/ > > Good suggestion. > OK how is this? > It doesn't print what I expect. > Does it print what you expect? > > name="123-xyz-abc" > for x in name: > if x in range(10): > print ("Range",(x)) > if x in str(range(10)): > print ("String range",(x)) > > http://i.imgur.com/EGKUpAb.jpg
I suspect you're discovering the difference between the python2 and python3 range() functions, and what happens when you encapsulate them in string. I've already posted about this once this evening. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list