分类 about english 下的文章

import re
import time
file1 = open(r'..\data\剑桥双解清洗'+str(time.time())+'.csv', 'a',encoding='utf-8')
with open(r'..\data\剑桥双解清洗.txt',encoding='utf-8') as file:
    conten = file.readlines()
    for lin in conten:
        word=re.findall(r'<font style="font-weight:bold;">(.*?)</font>', lin)
        en = re.findall(r'<font style="margin-right:1px;">(.*?)\\n', lin)
        str_first1 = re.sub('<font style="color:navy;margin-left:12pt;" >',"|",str(en))
        str_first2 = re.sub('<.*?>',"",str(str_first1))
        print(str_first2)
        gg = str(word)+'\t'+str_first2 +'\n'
        file1.write(gg)

import re
import time
newtime = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
file1 = open(r'..\data\朗文双解清洗'+str(newtime)+'.csv', 'a',encoding='utf-8')
with open(r'..\data\朗文双解.txt',encoding='utf-8') as file:
    conten = file.readlines()
    for lin in conten:
        word=re.findall(r'[123459789]\..*', lin)
        en = re.findall(r'★.*', lin)
        print(en,word)
        gg = str(en)+'\n'+str(word) +'\n'
        file1.write(gg)

import re
import pandas as pd
df = pd.read_csv(r'..\data\剑桥双解清洗OkGGGGGGG.csv',sep='\t',header=None )

fslip=df.to_dict('split')
# print(fslip)
alst=fslip['data']
#
# print(alst)
lst=[]
key=[]
for i in range(len(alst)):
# for i in range(3):
    key.append(alst[i][0])
    # print(alst[i][1])
    lst.append(re.split(r'[■]+', alst[i][1]))
# print(key)
# print(lst)
data_values = {}
for k,v in zip(key,lst):
    # print(k,v)
    data_values[k] =v
print(data_values)

print(*data_values['perplex'],sep='\n')