如以下代码,怎么将输出的列表数据存入sqlite数据库中
import re
# 打开文件
with open(file=r"C:\Users\666666\Desktop\python课设\html50000-57010\data\50017.html", mode="r", encoding="utf-8") as d:
data = d.read()
# 获取文件中的有用数据
result = re.findall(r'("hometeam_name":"\w+"),"awayteam_id":\w+,("awayteam_name":"\w+"),"matchtime":\d+,'
r'("homescore":\d+,)("awayscore":\d+),"',data)
print(result)
输出数据:
[('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"亚达纳邦U19"', '"homescore":0,', '"awayscore":4'), ('"hometeam_name":"米瓦迪U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":4,', '"awayscore":0'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"茨瓦卡平联U19"', '"homescore":0,', '"awayscore":2'), ('"hometeam_name":"马圭U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":1,', '"awayscore":2'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"实皆联U19"', '"homescore":0,', '"awayscore":1'), ('"hometeam_name":"雅玛FCU19"', '"awayteam_name":"治尼兰德U19"', '"homescore":1,', '"awayscore":5'), ('"hometeam_name":"南缅甸U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":6,', '"awayscore":0'), ('"hometeam_name":"伊洛瓦底U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":5,', '"awayscore":0'), ('"hometeam_name":"拉科尼联U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":3,', '"awayscore":1'), ('"hometeam_name":"拉科尼联U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":2,', '"awayscore":0'), ('"hometeam_name":"伊洛瓦底U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":4,', '"awayscore":0'), ('"hometeam_name":"马圭U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":4,', '"awayscore":1'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"南缅甸U19"', '"homescore":0,', '"awayscore":3'), ('"hometeam_name":"汉达瓦底联U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":2,', '"awayscore":2'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"仰光联U19"', '"homescore":1,', '"awayscore":2'), ('"hometeam_name":"实皆联U19"', '"awayteam_name":"治尼兰德U19"', '"homescore":2,', '"awayscore":1'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"拉科尼联U19"', '"homescore":2,', '"awayscore":1'), ('"hometeam_name":"治尼兰德U19"', '"awayteam_name":"亚达纳邦U19"', '"homescore":0,', '"awayscore":4')]