How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

Denis McMahon denismfmcmahon at gmail.com
Fri Nov 7 23:22:47 CET 2014


On Fri, 07 Nov 2014 21:22:22 +0630, Veek M wrote:

> Veek M wrote:
> 
> 
>>                 new_col = self.b[row].index('def') self.w.cursor = row,
>>                 new_col
> 
>>                 new_col = self.b[row].rindex('def')
>>                 self.w.cursor = row, new_col
> 
> There's also the different methods index vs rindex.

yes, those fall under point 2 of my earlier post. "something" and 
"something else" would be the complete means of calculating the value to 
assign to variable.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list