View Single Post
Old 05-18-2012, 03:15 PM   #299
pawcook
Junior Member
pawcook began at the beginning.
 
Posts: 2
Karma: 10
Join Date: May 2012
Device: kindle
Quote:
Originally Posted by pchrist7 View Post
Hi pawcook
Hmm, I wonder if all indents in the program code are <TABS> ?
Must be.
Your quote of original post step 5 looks weird ?
Looks like 1 line, should be 22 lines like this:
Code:
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct,  
				is_reading_str, no_page_read_str):
	try:
		test_val = int(is_read_pct)
	except:
		return 'is_read_pct is not a number'

	import re
	mg = re.match('.*\s(\d+[-/]\d+[-/]\d+).*?Last Page Read: Location \d+ \((\d+)%\)', val, re.I + re.DOTALL);
	if mg is None:
		return no_page_read_str
	date = mg.group(1)
	pct = mg.group(2)
	try:
		f = int(pct)
		if f > test_val:
			return date
		elif f > 0:
			return is_reading_str + ': ' + pct + '%'
	except:
		pass
	return no_page_read_str
Please give it another try.

Cheers, Per
Per thank you so very much, that works a treat now.
pawcook is offline   Reply With Quote