IO操作篇: def write_to_file(content): with open('result.txt','a',encoding='utf-8') as f: f.write(content+" ")