So essentially I'm looking for specifically a 4 digit code within two angle brackets within a text file. I know that I need to open the text file and then parse line by line, but I am not sure the best way to go about structuring my code after checking "for line in file".
I think I can either somehow split it, strip it, or partition, but I also wrote a regex which I used compile on and so if that returns a match object I don't think I can use that with those string based operations. Also I'm not sure whether my regex is greedy enough or not...
I'd like to store all instances of those found hits as strings within either a tuple or a list.
Here is my regex:
regex = re.compile("(<(\d{4,5})>)?")
I don't think I need to include all that much code considering its fairly basic so far.