攝影或3C

Python TQC考題909

#Python TQC考題909

f_name = “data.dat”
file = open(f_name,”wb”)
# TODO
for i in range(5):
inp = input()
b_inp = bytearray(inp+”\n”,”utf-8″)
file.write(b_inp)

file.close()
print(‘The content of “data.dat”:’)
with open(f_name,”rb”) as file:
for line in file:
print(line.decode(“utf-8”))

“””
The content of “data.dat”:
“””

 

#只要加encoding=”utf-8″

#b模式都用不到,如: rb, wb

 

儲蓄保險王

儲蓄險是板主最喜愛的儲蓄工具,最喜愛的投資理財工具則是ETF,最喜愛的省錢工具則是信用卡