I am reading an OCR image file and converting it to text. Now, I need to extract one specific text.
Generated text (Not complete text):
FROM: 2902 W SWEETWATER AV #1100 Phoenix, AZ 95029 TO: BANNER THUNDERBIRD MED CTR 5855 W THUNDERBIRD RD Glendale, AZ 85307 c9 23 1975 x
I need to extract 95029 under FROM: segment. I was thinking to get the line number of FROM: segment first then do plus one to get the next line number and apply regular expression to retrieve text.But, I am not able to text of next line number.
for num, line in enumerate(text.splitlines()): if 'FROM:' in line: num = num+1 print(num) break #print(line)
I am able to get line number but not text. Please suggest.