def main():
filename = input("filename: ")
with open(filename, "w") as ghi:
empty_list = []
for aline in ghi:
lines = aline.split()
print(empty_list.append(lines))
print(ghi)
mian()
编写主要功能:
我收到错误:
for aline in ghi:
io.UnsupportedOperation: not readable
答案 0 :(得分:1)
使用open
打开文件时,第二个参数指定您是在阅读还是写作。传递"w"
是一个承诺,你只会写,永远不会读。考虑
with open(filename, "r") as ghi: