f = open(‘buffer.py‘,‘w+‘)#打开文件,如果没有该文件则新建文件 f.write(data)#写入文件 f.close()#关闭文件
file1 = open(‘/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/telemetry/buffer.py‘,‘w+‘)#打开文件 a_string =file1.read()#读文件
file1 = open(‘/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/telemetry/buffer.py‘,‘w+‘)#打开文件 file1.truncate()#清空文件内容