for name, group in groups: # 创建文本文件 hotel_name = re.sub('[^\w]', '',name) with open(folder_path + hotel_name + '.txt', 'w',encoding='utf-8') as f: # 写入好的方面和坏的方面 for comment in group['好的方面']: if isinstance(comment, str): f.write(comment + ' || ') for comment in group['差的方面']: if isinstance(comment, str): f.write(comment + ' || ') f.write('\n')

for name group in groups # 创建文本文件 hotel_name = resub^w name with openfolder_path + hotel_name + txt wencoding=utf-8 as f # 写入好的方面 fwrite好的方面:n for comment in group好的方面

原文地址: https://www.cveoy.top/t/topic/fJgv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录