re.search when used within an if/else fails
kevinintx at gmail.com
Tue Nov 20 00:43:10 CET 2012
python version 2.4.3, yes i know that it is old. getting the sysadmin to update the OS requires a first born.
with the following code..
for signal in register['signals'] :
351 sigName = signal['functionName']
352 if re.search( "rsrvd", sigName ) == None :
353 print sigName
354 newVal = "%s%s" % ( '1'*signal['bits'] , newVal ) #prepend 0's
355 if re.search( "rsrvd", sigName ) != None :
356 print sigName
357 newVal = "%s%s" % ( '0'*signal['bits'], newVal )
regardless of how i code line 352, i can not EVER use an else clause with it. if i use an else clause, the else will NEVER get executed...
has any one experienced anything like this behavior? any suggestions? the above code works but... why should i have to code it like this?
More information about the Python-list