我正在使用Dir选择基于标准的文件列表,然后将它们存储在字符串数组中.然后我遍历数组并处理文件.
如何使用unicode字符处理文件名?
我试着这样做,StrConv但没有帮助.
vfile = Dir(vCurrDir & vCrit, vbNormal) 'vCrit is something like *test*
Run Code Online (Sandbox Code Playgroud)
然后我会尝试访问文件的属性,如下所示:
vfilename = vCurrDir & "\" & vfile
Set objFSO = CreateObject("Scripting.FileSystemObject")
vDateMod = objFSO.GetFile(vfilename).datelastmodified
Run Code Online (Sandbox Code Playgroud)
在最后一行,我收到一条错误消息,指出找不到文件.这仅适用于具有unicode字符的文件名.
这里有另一篇关于此的帖子:在VBA中使用Unicode文件名(使用Dir,FileSystemObject等),但它没有t solve the problem withDir`.
我的示例:VBA(watch)c:\ my-test-file.pdf Unicode:c:\ my-test-file.pdf
(你不能在这里看到区别但是如果你复制名称并将它们粘贴到Notepad ++中,你会看到两个文件的破折号是不同的字符,VBA正在将unicode破折号字符转换为windows locale破折号)
或链接问题的示例:3_Połish.txt(在Unicode中)与3_Polish.txt(在VBA中)
初始化带有术语列表的新PhraseMatcher时出现以下错误:
ValueError:Pattern length(11)> = phrase_matcher.max_length(10).长度可以在初始化时设置,最多10个.
patterns = [nlp(org) for org in fields]
self.matcher = PhraseMatcher(nlp.vocab)
self.matcher.add('FIELD', None, *patterns)
Run Code Online (Sandbox Code Playgroud) 我正在运行python zipfile extractall,将其解压缩到长度超过255个字符的路径。在Windows 7 64bit上运行。我要跟踪以下错误[Errno 2] No such file or directory: u'
有任何想法吗 ?
我要从中提取的网络文件夹。因此,我将该文件夹安装为网络驱动器t:\,这暂时解决了该问题。