# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' file1 = open(r'C:\\Users\\86186\\Desktop\\test2.txt','w',encoding='utf-8') file1.write('小兰:12本\n')