a = 'words_file.txt'
b = open(a,'r',encoding='utf_8')
c=b.read()
d =a.strip('.')
new_file = open(flag[0]+'new_file'+'.txt','w',encoding='utf_8')
new_file.write(c)
b.close()
print(new_file.read())
new_file.close()
Traceback (most recent call last):
File "C:\Users\LENOVO\PycharmProjects\pythonProject\2.py", line 5, in
new_file = open(flag[0]+'new_file'+'.txt','w',encoding='utf_8')
NameError: name 'flag' is not defined. Did you mean: 'float'?
进程已结束,退出代码1