Lebowski Poetics With Python
Write a Python program that takes a text as input and outputs a “munged” version.
I used the following simple Python script on one of my favorite movies, The Big Lebowski. Here’s the code:
searchstr = “Dude is”
for line in sys.stdin:
line = line.strip()
if searchstr in line:
print line [/sourcecode]
This was the output:
The Dude is a small figure walking across the vast lot.The Dude is going up the walkway of a small Venice bungalow
The Dude is propelled across the bedroom and on into a small
The Dude is heading for the door.
At the table next to the answering machine the Dude is mixing
chairs. The Dude is staring off towards the bowler.
The Dude is flying over the city, his arms thrown out in
The Dude is twisting around to pull the money briefcase from
The Dude is thrown forward as the car hits something.
The Dude is slumped disconsolately back in his easy chair,
The Dude is at the bar, a bottle of kalhua frozen halfway
The Dude is grabbed from behind and muscled away in a half-
The Dude is shoved in and awkwardly takes a seat facing the
the Dude is the big Lebowski, a comforter across his knees.
Lebowski stares at him, dumbstruck. The Dude is encouraged.
The Dude is staring at his toes, which protrude from the
The Dude is driving home. A Creedence tape plays. The Dude
The Dude is looking around at the ’60′s modern decor.
The Dude is walking down a long corridor dressed as a cable
The Dude is running blearily down the middle of the Pacific
The Dude is hurled against the chief’s desk, which he bounces
The Dude is stupefied.
A match is dragged across a headboard; the Dude is lighting
The Dude is staring off into space, thinking. His answer is
The Dude is leaving the bedroom.
The Dude is stunned.
The Dude is digging into his pocket.
The Dude is near tears.
What I really like about this is that the only thing that remains are the script’s directions. There’s not a single line of dialogue is evident here, and I think it still tells the story rather well. I tried playing around with some search and replace Python codes as well as some random word replacements, and the results were also interesting. However, I chose to keep this because it was my favorite.
Next, I took the same text file and a ran the following UNIX command on it:
[sourcecode language='python'] grep “life” -i <lebowski.txt | sort -fd | uniq [/sourcecode]
The above script goes through the text and looks for the word “life,” or any variation thereof. It then sorts the resulting lines alphabetically (both uppercase and lowercase) and excludes any repetitions:
A tree of life, Dude. To all who
approve of my lifestyle and, needless
break only if it’s a matter of life
every bum’s lot in life is his own
forget, Dude–that keeping wildlife,
goddamn money. HER LIFE WAS IN YOUR
Her life is in your hands.
Her life is in your hands, Dude.
Life does not stop and start at your
life of achievement, on challenges
of my life. Are you surprised at my
up! You fucked it up! Her life was
worrying about that shit. Life goes
flickers to life. A title card:
Life Magazine cover which is headlined ARE YOU A LEBOWSKI
I really love the ending of this one. It’s got a beautiful conclusion that seems to wrap it all up nicely. There really wasn’t any rhyme or reason for choosing the word ‘life.’ I could have chosen ‘bowling,’ but I wanted to try using a word that felt more random and less germane to the movie’s plot.