我正在编写一个 Jython 脚本来对 URL 列表进行排序。
我有一个看起来像这样的列表:
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/folder2/folder3/|, 1
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/folder2/folder3/|,1
管道和逗号将路径与该路径下的文件数量分开。是否有可能使用 Jython 按长度对 URL 进行排序,所以它最终看起来像下面的列表:
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/folder2/|,1
http:// /www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/folder2/folder3/|,1
http://www.domain.com/folder1/folder2/folder3/|,1
希望你们明白我的意思,任何帮助将不胜感激。干杯