Jul-03-2018, 01:23 PM
(This post was last modified: Jul-03-2018, 01:23 PM by ichabod801.)
digit_re = re.compile('\d+') def re_count(text): return len(text) - len(digit_re.sub(text, ''))
Output:count_func took 7.043 sec
smart_count_digits took 0.945 sec
ick_count took 0.622 sec
re_count took 0.061 sec
Edit: Function gave wrong answer, corrected function and reran times.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures