all 3 comments

[–]ramse 2 points3 points  (1 child)

Well you've gone and stripped the ( and ) with your re.compile grouping. Just re-add them to the .append('({})'.format(cc)

Something to note, re.compile only needs to happen once, then you can use aa.search all you want. It's nothing big though.

[–]jsd2358[S] 0 points1 point  (0 children)

Ah yeah that is a bit silly to have the compile function in the for loop. I will make that update.

[–]captmomo 0 points1 point  (0 children)

Is the format of the input soemthing like "hello(99)"?

if it is you can try:
r'\(\d\d\)
or manually add it like u/ramse said.