More playing with Python

Continuing on my Mad Libs theme, I used a dictionary in Python to humorously alter a portion of a recent Republican debate – check the output here.

import sys

myDict = {'taxes': 'galactic libidos', 'American': 'Snorks and Smurfs', 'spend' : 'donate most generously', 'Speaker' : 'Arch Chancellor', 'Governor' : 'Beloved steward', 'Senator' : 'Agent of Doom', 'President' : 'Loving Creator', 'Obama' : 'Zoltar', 'dollars' : 'frilly greenies', 'capitalism' : 'giving yourself to the void', 'Gingrich' : 'Kardashian', 'Santorum' : 'McBismarck', 'Romney' : 'Gentlefoot the Tender', 'GINGRICH' : 'KARDASHIAN', 'SANTORUM': 'McBISMARCK', 'ROMNEY' : 'GENTLEFOOT THE TENDER', 'PAUL' : 'HORSEHEAD THE BRAVE', 'people' : 'paint-drinkers', 'attack' : 'smackdown', 'health' : 'damage control', 'working' : 'slobbering incessantly', 'South Carolina' : 'New Endor', 'thank you' : 'many good nubbins, nubbins indeed', 'finish' : 'gratify to completion', 'budget' : 'fabrege egg collection', 'cut' : 'take away', 'jobs' : 'small piles of avian doodie nuggets', 'Perry' : 'Shooter McGavin', 'zero' : 'darn near nuthin', 'War' : 'big hullabaloo', 'veteran' : 'sucka', 'Republican' : 'loyal young lumpards', 'debate' : 'Oktoberfest', 'Congressman' : 'Beastmaster in the War Against Evil', 'MR.' : 'The dude named', 'House' : 'Acroyoga Tee Pee', 'Senate' : 'Leigon of Candybar Lovers Everywhere', 'unemployment' : 'feeling gassy', 'voters' : 'fleshy one nubbers', 'Newt' : 'McGarnigal', 'Rick' : 'Wombatius', 'Mitt' : 'Ulf', 'Ron' : 'Horatius', 'tax' : 'nutella reserves', 'government' : 'soft-spoken sages wearing frilly lace cravates', 'CEO' : 'Head Honcho #1', 'Bain' : 'Cancerstix R Us', 'profit' : 'that sweet, succulent nether nectar', 'energy' : 'power pus', 'China' : 'Swinetown', 'Barack' :'Chronblaster', 'businesses' : 'sweet little teapots', 'market': 'smarty-pants system', 'America' : 'Mighty Nubtown', 'economy' : 'phlemgy mucus generator', 'Paul' :'Lil Bow Wow', 'financial' : 'gastro-nonomic', 'president' : 'favorite little pup', 'federal' : 'top flight and super official', 'program' : 'dietary regimen', 'economic' : 'slightly salty', 'debt' : 'blubber around the midsection and buttocks', 'killing' : 'wailing on, and I mean really wailing on', 'banks' : 'small gopher communities', 'business' : 'brothel', 'successful' : 'so very greasy', 'applause' : 'wild whoopin and a-hollerin', 'boo' : 'faint grumbling', 'Democratic' : 'Dandilicious'}

for line in sys.stdin:
    line = line.strip()
    for k, v in myDict.iteritems():
        line = line.replace(k,v)
    print line