将代码产品保存为文本文件

时间:2016-04-04 20:49:27

标签: file save

您好我想知道如何将其保存为文本文件。在Word,Excel甚至只是记事本。 感谢

print 'The Solar Atitude is:', ("%.1f" % Altitude),'°'
print 'The Solar Azimuth is:', ("%.1f" % Azimuth),'°'
print 'The unprotected window area is:', ("%.0f" % Unprotected_Window_Area),'mm^2'
print 'The Shading Transmittance of the indented window using the given data is:', ("%.1f" % Shading_Transmittance_Percentage),'%'

1 个答案:

答案 0 :(得分:0)

例如:

with open('test.txt', 'wt') as f:
    f.write('The Solar Atitude is:%.1f°\n' % (Altitude,))
    f.write('The Solar Azimuth is:%.1f°\n' % (Azimuth,))
    f.write('The Shading ... is:%.1f%%\n' % (Shading_Transmittance_Percentage,))