2016-04-04 10 views
0

こんにちは私はそれをテキストファイルとしてどのように保存することができますか? Word、Excel、または単にメモ帳で。 f.write( 'シェーディング透過率Pecentage:たとえば おかげコードの製品をテキストファイルとして保存する

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),'%' 

答えて

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,)) 
+0

あなたが最後の行に助けてもらえ、私は思います%1f%\ n '%(Shading_Transmittance_Percentage、)) – rwm

+0

あなたのコメントに対する% –

関連する問題