小编Att*_*tti的帖子

如何使用Dir在VBA中处理带有unicode字符的文件名?

我正在使用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中)

unicode excel vba excel-vba

6
推荐指数
1
解决办法
1993
查看次数

Spacy PhraseMatcher值错误模式长度(11)> = phrase_matcher.max_length(10)

初始化带有术语列表的新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 spacy

3
推荐指数
1
解决办法
863
查看次数

从长路径提取文件时,Windows上的Python Zipfile extractall IOError

我正在运行python zipfile extractall,将其解压缩到长度超过255个字符的路径。在Windows 7 64bit上运行。我要跟踪以下错误[Errno 2] No such file or directory: u'

有任何想法吗 ?

我要从中提取的网络文件夹。因此,我将该文件夹安装为网络驱动器t:\,这暂时解决了该问题。

python zipfile windows-7

2
推荐指数
1
解决办法
1114
查看次数

标签 统计

python ×2

excel ×1

excel-vba ×1

spacy ×1

unicode ×1

vba ×1

windows-7 ×1

zipfile ×1