I have some text that looks like:
California(2342)
My object has a property that I need to assign the value 2342 to.
I'm looking for input on how to go about doing this, and guarding against any potential for errors in the input.
c = SomeClass()
c.count = re.compile(r'(\d*)').groups[0]
Does that look ok? Or should I do an IF statement and set the count to 0 in case the input was bad?
P.S any help in the regex would be appreciated, this is my first serious python script.