Well, the problem is that given the fraction eg:1/3 answer 0.3333333 should be represented as 0.(3) and 0.2325555 as 0.232(5) I figured out a way to split the line when one digit is repeated:
using re.findall(r'^(.+?)((.)\3+)$', '42344444' )[0][:-1] (ignoring 0. before the number)
but I want to know how to do this if the template is 0.324324324.. to get 0.(324)
source share