You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
585 B

data_list = [] # 存放AI弹幕列表
f = open('全弹幕.txt',encoding='utf-8')
keywords = ['AI','Ai','ai','智能','人工智能','网络','自动','全息','投影','8k','8K'] # 关键词
for index in f:
if any(i in index for i in keywords)==True: # 对每个弹幕进行判断,是否至少包含一个关键词
print(index)
data_list.append(index) # 写入AI弹幕列表
print(data_list) #打印出来更加直观
for index in data_list:
with open('AI弹幕.txt',mode='a',encoding='utf-8') as f:
f.write(index) # 写入AI弹幕.txt文本