Rosetta Code/Rank languages by popularity: Difference between revisions

From Rosetta Code
Content added Content deleted
(New page: Category:Text processingCategory:Networking and Web InteractionCategory:Sorting Sort most popular programming languages based in number of members in Rosetta Code categorys (f...)
 
No edit summary
Line 1: Line 1:
[[Category:Text processing]][[Category:Networking and Web Interaction]][[Category:Sorting]]
[[Category:Text processing]][[Category:Networking and Web Interaction]][[Category:Sorting]]

Sort most popular programming languages based in number of members in Rosetta Code categorys (from http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=500)
Sort most popular programming languages based in number of members in Rosetta Code categorys (from http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=500)



Revision as of 00:07, 24 January 2009

Sort most popular programming languages based in number of members in Rosetta Code categorys (from http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=500)

Output:

1. 246 - Programming_Tasks 
2. 203 - Python 
3. 201 - Ada 
4. 188 - OCaml 
5. 171 - Perl 
6. 169 - Java 
7. 168 - Haskell 
8. 157 - C 
9. 141 - Forth 
10. 140 - Ruby 
...

Python

<python>import urllib import re

def key1(x):

   return int(x.split()[0])

test = [] a = urllib.urlopen("http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=500") a = a.read().strip().split("\n")

a = [i for i in a if 'members' in i]

del a[0] del a[-1]

for i in a:

   test.append(re.findall("\(.* members\)",i)[0].split()[0].replace("(",) + " - "+\
   re.findall('Category:.*" ',i)[0].replace('"',).split(":")[1])

c = 1

for i in sorted(test, key=key1, reverse=True):

   print "%s. %s" % (c, i)
   c += 1</python>