把str写入xxx.txt with open('/home/bluejade/CODE/GetupQiyeSleep/testsave.txt','w') as f: f.write('测试内容保存')