问题描述
在Windows PC上,哪些Python软件包和函数支持路径名> 260个字符,而哪些不支持? 为什么有些不做的原因是什么?这在任何地方都有记录吗?
我在Windows 10 PC上运行Python 3.7;我需要读取文件夹中的所有csv文件。我注意到了:
我发现这很奇怪:我希望Python的功能永远不会识别长路径,或者总是会这么做。
我在下面有一个例子:
import pandas as pd
import os
import glob
mypath = 'x://very long path//with many folders//and subfolders'
myfiles_glob = glob.glob(mypath + '\*.csv')
myfiles_scandir = []
with os.scandir(mypath) as it:
for entry in it:
if entry.name.endswith(".csv") and entry.is_file():
myfiles_scandir.append(entry.path)
for f in myfiles:
print(os.path.isfile(f))
pd.read_csv(f,encoding='utf_8')
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)