New to Python
quindennis at grandecom.net
Wed Feb 10 04:30:52 CET 2010
Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to
PyScripter and will test tomorrow.
"Larry Hudson" <orgnut at yahoo.com> wrote in message
news:ybmdnRFZZ_3nvu_WnZ2dnUVZ_hGdnZ2d at giganews.com...
> Quin wrote:
>> s = f.readline()
>> if 'mystring' in s: print 'foundit'
>> if 'mystring' not in s: print 'not found'
>> if 'mystring' in s:
>> print 'processing'
>> this generates output:
>> not found
>> so, it doesn't find the substring, but goes into processing code anyway.
>> This is using IronPython
> As others have already said, this _does_ work properly.
> But a minor rearrangement is simpler, and IMHO clearer:
> if 'mystring' not in s:
> print 'not found'
> print 'foundit'
> print 'processing'
> -=- Larry -=-
More information about the Python-list