python操作文件写入内容,,[root@bogo
python操作文件写入内容,,[root@bogo
[root@bogon~]#catfile.py#/usr/bin/envpython#coding:utf-8ecs="efwefwffrfrer"ipaddrr="192.168.56.10"printtype(ecs+""+ipaddrr+"hasstopeed")defwrite_result(str):writeresult=file(r'/tmp/ecs.log','a+')str1=writeresult.write(str+'\n')writeresult.close()returnstrif__name__=="__main__":write_result(ecs+""+ipaddrr+"hasstopeed")[root@bogon~]#python操作文件写入内容
评论关闭