one line shell script to count number of entries

echo -n "Number of entries... ";
wget -q -O - http://www.pyweek.org/5/entries/ | grep 'clear: right' | wc -l

(log in to comment)

Comments

import urllib;
print len(urllib.urlopen("http://www.pyweek.org/5/entries/").read().split('clear: right')) -1
You dag :)

I noticed that someone mentioned pyweek in passing in an obscure comment on an obscure posting today that resulted in the single-highest number of hits from a single "news" posting about pyweek for a 24-hour period.

If we could only get the challenge mentioned as an article :)

Getting it on the front page of python.org would be nice :)
You want me to pull some strings over at www.arcadecontrols.com and get them to post it on the front page? I've been buddies with Saint & all those guys for years now.
import urllib;print urllib.urlopen("http://pyweek.org/5/entries").read().count("clear: right")

That is a few chars shorter, being only 94 chars long, the above is 107 :)
import urllib;print urllib.urlopen("http://pyweek.org/5/entries").read().count("clear: right")

That is a few chars shorter, being only 94 chars long, the above is 107 :)
BTW, we are at 70 now, woohoo! still a quite a bit off from last time though...
oops, sorry about double(oh, triple now) posting, my browser is acting funny again :/
78 characters.
from urllib import*;urlopen("http://pyweek.org/5/entries").read().count("
Sorry. It cut me off because I used the < character.
from urllib import*;urlopen("http://pyweek.org/5/entries").read().count("<dt")
Don't ask.
from socket import*;s=socket();s.connect(("pyweek.org",80));s.send("GET /5/entries/ HTTP/1.0\n\n");x=""
while True:
 try:i=s.recv(9);x+=[s.gettimeout(),i][bool(i)]
 except:True=0
False=sum([not True for a in x.split("<dt")[0:-1]])
print False or True
Haven't you people got warmup games to write? :)
hahaha. 51 characters.
wget -qO- http://pyweek.org/5/entries/|grep -c'<dt'
Richard: The warm-up is officially over ;) and I didn't make anything, all I have time for right now are cute one-liners ;)

illume: but that isn't python ...

neko: nice :)
A variation of illume's
wget -qO- http://pyweek.org/5/entries|grep -c \<dt
50 characters
34 characters.
wget -qO- xrl.us/5pyw|grep -c \<dt
I'm such a cheater. :)

(or, its 70 character python alternative:
from urllib import*;urlopen("http://xrl.us/5pyw").read().count("<dt")
)
57... lalalaaa
import os;os.system("wget -qO- xrl.us/5pyw|grep -c \<dt")
let us all cheat!

Haha Tee :)
Neppord, does that work for windows XP, or is it a linux call only(maybe I should test that...)
Err, it doesn't work, I guess good ol' python code is the only solution ;)
  • @neko on 2007/08/24 and Tee on 2007/08/25: neither of those will work. I forgot to put a print in there. ;)
  • Assuming you have the `a` module installed, this will always work:
    import a
  • By the way, Neppord's probably just needs to have `\\<dt` instead of `\<dt`.
neko: Bah. You can always run it in the interpreter directly. :)
If the user is smart enuf this would work eval(raw_input()) 17 chars
sorry wrong commands :P
exec(raw_input())
still 17 though