Python 3 代碼:file = open("amdPricesPrices.txt", "a+")prices = file.read()print(prices)文本文件內容:69.40 69.30 67.61 76.09 78.19 77.67 86.71 84.85當我執行此代碼時,它只打印一個空行,不打印任何內容。
3 回答

慕桂英546537
TA貢獻1848條經驗 獲得超10個贊
使用 a+ 用于附加到文件,而使用 r 用于讀取文件。
file = open("amdPricesPrices.txt", "r")
prices = file.read()
print(prices)
添加回答
舉報
0/150
提交
取消