或者李的版本。。。
(vl-remove-if
'(lambda (x) (member x '("." "..")))
(vl-directory-files "C:\\temp" nil -1)
)
或者我的
(vl-remove "."
(vl-remove ".."
(vl-directory-files "L:\\Scripts\\Notes\\" nil -1)
)
)
李,
根据您在引用的另一篇文章中共享的代码,您将列表数据设置为一个名为“data”的变量,如下所示:
(vl-remove-if
'(lambda (x) (wcmatch x "`.*"))
(vl-directory-files "C:\\tmp" nil -1)
)
我正在开发的程序将从位于共享驱动器上的文本文件中填充数据。如果我分配变量来表示不同级别的数据,那么将上述代码更改为以下代码是否同样容易:
(setq Data
'(
("Ferrari" . (("F430" . ("2005" "2006"))
("F355" . ("1994" "1995" "1996"))
("348" . ("1989" "1990" "1991"))))
("Porsche" . (("911" . ("2007" "2008" "2009"))
("928" . ("1992" "1993" "1994"))
("Boxster". ("2006" "2007" "2008"))))
("Aston Martin" . (("DB6" . ("1965" "1966" "1967"))
("Vantage". ("1994" "1997" "2000"))
("Vanquish" . ("2005" "2006" "2007"))))
)
)
我仍在处理第三级数据,所以现在这能处理两级数据吗?
朗尼 六羟甲基三聚氰胺六甲醚。。。不确定获取文件数据的方式-请记住,“F”将是一个列表,而不是一个字符串。。。
可能有许多方法可以构造数据,但在我的示例中,我发现在编写数据时,这种方法是最简单的,因为顶级项和所有子类别之间存在明确的链接—(而不是将每个级别分配给绑定到新变量的新列表…)
李 Hmmm... not sure about the way that you are getting at the file data - bear in mind that 'F' will be a list, not a string...
There are possibly many ways to structure the data, but in my example I found that way to be the easiest at the time of writing it, as there is a definite link between the top level item and all the sub categories - (as opposed to assigning each level to a new list bound to a new variable...)
Lee
页:
1
[2]