Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python os.listdir遇到无效参数_Python - Fatal编程技术网

Python os.listdir遇到无效参数

Python os.listdir遇到无效参数,python,Python,我正在尝试列出目录中的所有文件。对于名为“www.cherryhillpolice.com”的文件夹,os.listdir工作正常。但是对于一个名为“www.channellogistics.com”的,它抛出了一个无效参数的错误。我看不出这两条路有什么不同。我手动浏览了这两个文件夹。它们确实存在 >>> os.listdir( '/media/SAMSUNG/mirror1/www.cherryhillpolice.com' ) ['db3c06dd8d6f176d0a988

我正在尝试列出目录中的所有文件。对于名为“www.cherryhillpolice.com”的文件夹,os.listdir工作正常。但是对于一个名为“www.channellogistics.com”的,它抛出了一个无效参数的错误。我看不出这两条路有什么不同。我手动浏览了这两个文件夹。它们确实存在

>>> os.listdir( '/media/SAMSUNG/mirror1/www.cherryhillpolice.com' )
['db3c06dd8d6f176d0a988f7caabe511f.html']

>>> os.listdir( '/media/SAMSUNG/mirror1/www.channellogistics.com' )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: '/media/SAMSUNG/mirror1/www.channellogistics.com'
>>os.listdir('/media/SAMSUNG/mirror1/www.cherryhillpolice.com')
['db3c06dd8d6f176d0a988f7caabe511f.html']
>>>os.listdir(“/media/SAMSUNG/mirror1/www.channellogistics.com”)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
OSError:[Errno 22]无效参数:'/media/SAMSUNG/mirror1/www.channellogistics.com'

os.listdir('/media/SAMSUNG/mirror1/www.channellogistics.com')的预期输出是什么?您确定第二条路径拼写正确吗?如果在shell中执行ls/media/SAMSUNG/mirror1/www.channellogistics.com,会发生什么情况?@Elizion我想列出目录中所有文件的名称。@jwodder“cd/media/SAMSUNG/mirror1/www.channellogistics.com”可以正常工作。目录中有六个文件。
www.channellogistics.com
可能是指向目录的符号链接吗?