读取txt文件,并写入列表

import os

classes_path = os.path.expanduser('列表')
with open(classes_path, 'r', encoding='UTF-8') as f:
class_names = f.readlines()
class_names = [c.strip().replace('https://www.facebook.com/', '') for c in class_names]
print(f'keyword_list={class_names}')

posted @ 2022-02-15 17:05  布都御魂  阅读(179)  评论(0编辑  收藏  举报