Sorting list of URLs by length in Jython
- by Eef
Hi,
I am writing a Jython script to sort a list of URLs.
I have a list that looks like this:
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
The pipe and the comma separates the path from the amount of files that are under that path.
Is it possible some how use Jython to order the URLs by length, so it would end up look like the below list:
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
Hope you guys get what I mean, any help would be appreciated. Cheers