On 10/24/2014 12:07 PM, Seymore4Head wrote:
On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence
<snip>
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.

That is NO different from the useless crap you consistently give us! Tell us EXACTLY WHAT YOU EXPECT!!

Does it print what you expect?
Yes it does.  But what I expect is different from what you (erroneously) expect.

name="123-xyz-abc"
for x in name:
     if x in range(10):
x is a character (a one-element string). range(10) is a list of ints. A string will never match an int. BTW, as it is used here, range(10) is for Py2, for Py3 it needs to be list(range(10)).

         print ("Range",(x))
     if x in str(range(10)):
Once again, find out what str(range(10)) actually is. It is NOT what you think it is. And I'll reiterate what everyone here keeps telling you: USE THE INTERACTIVE MODE to see what really goes on. If you keep resisting this you are making your understanding several hundred times more difficult.

         print ("String range",(x))

Sorry for the harsh tone.  I'm old, and the curmudgeon is starting to come out 
in me.

     -=- Larry -=-

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

Reply via email to