|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
各位大神好,如下的代码中,我新建程序名为“hh.txt"、”ph.txt"等均不报错,而新建程序名为“test.txt”、“tes.txt”等程序均报错,路径应该是一样的,但不知道错在哪了。希望能给予解答,谢谢!版本是3.6.0
>>> f=open('D:\\python\python程序\练习程序\hh.txt','w')
>>> f=open('D:\\python\python程序\练习程序\test.txt','w')
Traceback (most recent call last):
File "<pyshell#413>", line 1, in <module>
f=open('D:\\python\python程序\练习程序\test.txt','w')
OSError: [Errno 22] Invalid argument: 'D:\\python\\python程序\\练习程序\test.txt'
>>> f=open('D:\\python\python程序\练习程序\tes.txt','w')
Traceback (most recent call last):
File "<pyshell#414>", line 1, in <module>
f=open('D:\\python\python程序\练习程序\tes.txt','w')
OSError: [Errno 22] Invalid argument: 'D:\\python\\python程序\\练习程序\tes.txt'
>>> f=open('D:\\python\python程序\练习程序\te.txt','w')
Traceback (most recent call last):
File "<pyshell#415>", line 1, in <module>
f=open('D:\\python\python程序\练习程序\te.txt','w')
OSError: [Errno 22] Invalid argument: 'D:\\python\\python程序\\练习程序\te.txt'
>>> f=open('D:\\python\python程序\练习程序\ph.txt','w')
>>> f=open('D:\\python\python程序\练习程序\t.txt','w')
Traceback (most recent call last):
File "<pyshell#417>", line 1, in <module>
f=open('D:\\python\python程序\练习程序\t.txt','w')
OSError: [Errno 22] Invalid argument: 'D:\\python\\python程序\\练习程序\t.txt'
>>> f=open('D:\\python\python程序\练习程序\a.txt','w')
Traceback (most recent call last):
File "<pyshell#418>", line 1, in <module>
f=open('D:\\python\python程序\练习程序\a.txt','w')
OSError: [Errno 22] Invalid argument: 'D:\\python\\python程序\\练习程序\x07.txt'
>>> f=open('D:\\python\python程序\练习程序\er.txt','w')
\t 是制表符,你可以这样写,要转义字符,或者用前面加R,如图
|
|