EOL while scanning string literal 报错

if os.path.getsize('j:/v.txt')==0:
path=r'j:/v'
f=open('j:/v.txt','w')
for filename in os.listdir(path):
f.write(os.path.join(path,filename,'\\n'))

f.close()

 文件名后面的’\'要注意

posted @ 2021-12-07 22:41  星尘ome  阅读(87)  评论(0)    收藏  举报