So, I have using the following to grab numbers from MS Word. I discovered that
that there is a "special"
rule being used for rounding.
If a ??.5 is even the number is to rounded down (20.5 = 20)
if a ??.5 is odd the number is to rounded up (21.5 = 22)
Brands = ["B1","B2"]
A1 = []
A1 = [ re.search(r"(?m)(?s)\r%s.*?SECOND.*?(?:(\d{1,3}\.\d)\s+){2}" % i,
target_table).group(1) for i in Brands ]
A1 = [int(float(str(x))+0.5) for x in A1 ]
print A1
Any solutions for this line with the above conditions?
Just as a note, any other number ??.3,??.7 follows the normal pattern
of rounding (21.3 = 21, 20.3 = 20, 21.7 = 22, 20.7 = 21)
A1 = [int(float(str(x))+0.5) for x in A1 ]
Lance
--
http://mail.python.org/mailman/listinfo/python-list