Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting list of URLs by length in Jython
    text
    copied!<p>I am writing a Jython script to sort a list of URLs.</p> <p>I have a list that looks like this:</p> <p><a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/folder3/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/folder3/|,1</a><br /> <a href="http://www.domain.com/folder1/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/folder3/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/folder3/|,1</a><br /></p> <p>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:</p> <p><a href="http://www.domain.com/folder1/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/|,1</a><br /> <a href="http://www.domain.com/folder1/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/folder3/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/folder3/|,1</a><br /> <a href="http://www.domain.com/folder1/folder2/folder3/|,1" rel="nofollow noreferrer">http://www.domain.com/folder1/folder2/folder3/|,1</a><br /></p> <p>Hope you guys get what I mean, any help would be appreciated. Cheers</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload