Language Python
(Creative version)
Date: | 11/06/05 |
Author: | Schizo |
URL: | n/a |
Comments: | 16 |
Info: | http://www.python.org/ |
Score: | (3.04 in 512 votes) |
'''A more interesting way to get the lyrics to "99 Bottles of Beer on the Wall", in Python. Is this considered cheating?''' import re, urllib print re.sub('</p>', '', re.sub('<br>|<p>|<br/> |<br/>','\n', re.sub('No', '\nNo', urllib.URLopener().open('http://www.99-bottles-of-beer.net/lyrics.html').read()[3516:16297])))
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
This example demonstrates the simplicity | Gerold Penz | 07/23/05 | 15 | |
Advanced, extensible beer/wall framework | Jamie Turner | 05/17/06 | 7 | |
minimal version | Oliver Xymoron | 04/20/05 | 5 | |
using lambda in LISP style | J Adrian Zimmer | 11/14/06 | 2 | |
Exception based | Michael Galpin | 02/08/08 | 0 | |
functional, w/o variables or procedures | Ivan Tkatchev | 07/14/05 | 2 | |
minimal version with singular | Emlyn Jones | 06/13/05 | 3 | |
Fully compliant version | Ricardo Garcia Gonzalez | 01/15/06 | 7 | |
Using a iterator class | Eric Moritz | 01/20/06 | 2 | |
New conditional expressions in 2.5 | Ezequiel Pochiero | 12/18/06 | 1 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
Daniel said on 03/10/06 06:07:13
I'm giving you five stars, just for being a smartass.
forrestcupp said on 07/31/06 15:05:51
Yeah, that's cheating
2kzombie said on 05/07/07 20:59:17
Thats just ingenius. In simplicty we trust, code is great
Grega said on 12/18/07 23:11:34
TOP GEEK
byeTwo said on 01/01/08 20:23:39
In-genius.
I beleive this is not cheating.
Wes said on 02/10/08 11:25:41
Honestly now, I would say congrats on pulling off a smart-ass method, but it doesn't have any tolerance for error, so for that reason alone I'm going to give a rating of 3. Nice concept, none-the-less.
Anirudh said on 03/02/08 10:44:55
nice, but if the source code or the site design is changed even the slightest bit, your code won't work.
Brad said on 03/08/08 22:01:08
OK. 10 for uber-geekness. 1 for utility. I'm kicking the tires on scripting languages right now. I've been an OO Java developer for 10 years (since 1.1.3beta) but the weakest link in my tool box is lack of a scripting language. So looking at this side-by-side with Ruby, Groovy, et al. does me no good.
Andrew said on 05/01/08 08:28:44
Smartass version for sure!
Dylan said on 05/05/08 00:31:57
winrar
Timothy Soehnlin said on 09/21/08 23:33:54
A more robust version could be:
import urllib, re
w = '99 bottles of beer on the wall'
t = urllib.URLopener().open('http://www.99-bottles-of-beer.net/lyrics.html').read()
print re.sub('<[^>]+>','\n', t[t.index(w+', 99'):t.rindex(w)+len(w)])
It checks for the opening of the song and the end of the song, and takes everything inside of it. Not as short as the supplied version, but a bit more robust.
OHAI said on 11/30/08 17:02:06
BAWHAHAHAAHHAHAW
ParadoxGreen said on 03/29/09 09:09:33
Excellent concept!
I betcha the other languages couldn't do the same in so few lines.
Jonny said on 04/12/09 02:31:06
I belive making a version that will have the rules changed, is a badge of honor.
This one sure is great
CountRob said on 06/14/09 02:54:48
The best program on this site, period. Done the true hacker way.
Bla said on 03/05/10 20:49:57
Hahahahahaa! But you need Internetacces to run this program.