#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
近期留言