Regular expression to capture model numbers

2009-04-22 Thread krishnapostings
My quick attempt is below: obj = re.compile(r'\b[0-9|a-zA-Z]+[\w-]+') >>> re.findall(obj, 'TestThis;1234;Test123AB-x') ['TestThis', '1234', 'Test123AB-x'] This is not working. Requirements: The text must contain a combination of numbers, alphabets and hyphen with at least two of the three eleme

class variables and class methods

2009-04-17 Thread krishnapostings
I have a class whose job is to serve several other objects, this object is in a module 'M1', let's say it writes logs, no matter who calls it, (once it started writing to a file) it must continue writing to the same file, the file pointer could be a class variable here and there is also no need to