I am out of trial and error again Lists
Denis McMahon
denismfmcmahon at gmail.com
Fri Oct 24 17:49:27 EDT 2014
On Fri, 24 Oct 2014 15:07:06 -0400, Seymore4Head wrote:
> On Fri, 24 Oct 2014 19:40:39 +0100, Mark Lawrence
> <breamoreboy at 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, denismfmcmahon at gmail.com
More information about the Python-list
mailing list