路径中的空格没有问题,因为您没有使用“外壳”来打开文件。这是Windows控制台上的一个会话来证明这一点。你做错了什么
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on wi32Type "help", "copyright", "credits" or "license" for more information.>>> import os>>>>>> os.makedirs("C:/ABC/SEM 2/testfiles")>>> open("C:/ABC/SEM 2/testfiles/all.txt","w")<open file 'C:/ABC/SEM 2/testfiles/all.txt', mode 'w' at 0x0000000001D95420>>>> exit()C:UsersGnibbler>dir "C:ABCSEM 2testfiles" Volume in drive C has no label. Volume Serial Number is 46A0-BB64 Directory of c:ABCSEM 2testfiles13/02/2013 10:20 PM <DIR> .13/02/2013 10:20 PM <DIR> ..13/02/2013 10:20 PM 0 all.txt 1 File(s) 0 bytes 2 Dir(s) 78,929,309,696 bytes freeC:UsersGnibbler>


