How else can this code be simplified?

topic description

text extraction data. Txt:
1. The operating income of the company from January to September 2017, the net profit attributable to the owner of the parent company and the net profit attributable to the owner of the parent company after deducting non-recurring profits and losses were 987.6899 million yuan, 140.7998 million yuan and 136.49 million yuan respectively, up 10.27%, 35.63% and 20.30% from January to September 2016, respectively, reflecting the good operation of the company.
2. The main reasons for the company"s higher management expenses in 2015 than in 2014 and lower management expenses in 2016 compared with 2015 are as follows: in March 2015, the company"s registered capital increased from US $79 million to US $91.61256 million. Ningbo Lingqi, Ningbo Lingxi, Ningbo Lingqi, Ningbo Lingxin and Ningbo Lingxi are the employee shareholding platforms of the company, according to the company"s December 2014

.

request:
paragraphs 1 and 1, respectively, take out the following operating income, net profit attributable to the owner of the parent company, and net profit attributable to the owner of the parent company after deducting non-recurring profits and losses, in a tuple format, (date, name, value, unit), formatted as 2017-9-30, stored in list

II. Take out the registered capital of paragraph 2, that is, (2015, registered capital, 7900.00 US dollars), and deposit it into one list

topic sources and their own ideas

although to fulfill the requirements, there is still room for improvement. However, the technology is shallow and I don"t know how to use encapsulation to improve

.

related codes

the following is the current code:

**:**

-sharp- -coding:utf-8- -
class Extract ():

def __init__(self, result):
    self.result = result  -sharpresult = 

def extract2(self):
    file = open(self.result.decode("utf-8"), "r")
    key = file.read().decode("gbk")
    return key

**:**

-sharp- -coding:utf-8- -
import re

class Processing ():

def __init__(self, result):
    self.result = result

def processing(self):
    key = self.result
    print "\n" + key + "\n"
    list = []
    date = input("")
    sonList1 = [date]
    sonList2 = [date]
    sonList3 = [date]
    sonList4 = []
    file = open(".txt".decode("utf-8"), "r")
    key = file.read().decode("gbk")
    pattern = re.compile(u"([\d,.]+)")
    matcher = re.findall(pattern, key)
    pass
    pattern1 = re.compile(u"")
    matcher1 = re.search(pattern1, key)
    sonList1.append(matcher1.group())
    sonList1.append(matcher[0])
    sonList1.append("")
    sonList1 = tuple(sonList1)
    list.append(sonList1)
    pass
    pattern2 = re.compile(u"")
    matcher2 = re.search(pattern2, key)
    sonList2.append(matcher2.group())
    sonList2.append(matcher[1])
    sonList2.append("")
    sonList2 = tuple(sonList2)
    list.append(sonList2)
    pass
    pattern3 = re.compile(u"")
    matcher3 = re.search(pattern3, key)
    sonList3.append(matcher3.group())
    sonList3.append(matcher[2])
    sonList3.append("")
    sonList3 = tuple(sonList3)
    list.append(sonList3)
    pass
    pattern4 = re.compile(u"2015")
    matcher4 = re.search(pattern4, key)
    pattern5 = re.compile(u"")
    matcher5 = re.search(pattern5, key)
    sonList4.append(matcher4.group())
    sonList4.append(matcher5.group())
    sonList4.append(matcher[3])
    sonList4.append("")
    sonList4 = tuple(sonList4)
    list.append(sonList4)
    for i in range(0, 4):
        print "\n"
        for j in list[i]:
            print j,
            

Module call part:
-sharp- -coding:utf-8- -
import extract
import dataProcessing

a = input ("File name to be opened")
getData = extract.Extract (a)
c = getData.extract2 ()
operating = dataProcessing.Processing (c)
print operating.processing ()
-sharp" text extraction data. Txt""2017-09-30"

what result do you expect? What is the error message actually seen?

simplify code using encapsulation

Apr.05,2021
Menu