纠错filename input ("请输入文件名:\ n ") fp = open ( filename , W ch = input ("请输入字符串:\ n ") while ch !='@': if '@' in ch : t = ch . find ("@") fp . write ( ch [0:t]) break else : fp . write ( ch +"\ n ") ch = input (") fp . close (
时间: 2024-01-08 19:03:02 浏览: 51
This is used to fix a filenames path
纠错后的代码如下:
filename = input("请输入文件名:\n")
fp = open(filename, "w")
ch = input("请输入字符串:\n")
while ch != '@':
if '@' in ch:
t = ch.find("@")
fp.write(ch[0:t])
break
else:
fp.write(ch + "\n")
ch = input()
fp.close()
阅读全文