我想用os.getcwd()得到得是我当前文件得目录practice1
import sys
import os
import os.path
current_path = os.getcwd()
print(current_path)
i=int(input("输入一个数字"))
for x in range(0,i+1):
print(x)
with open(current_path+'/'+'123.txt','w',encoding='utf-8') as f:
f.seek(0)
f.write(str(x))
with open(current_path+'/'+'123.txt','w',encoding='utf-8') as f:
改为
with open(current_path+r''+'123.txt','w',encoding='utf-8') as f: