[Python-Dev] Fsrit Propttoye: SCLABMRE

Kevin J. Butler python-kbutler at sabaydi.com
Fri Sep 19 12:43:38 EDT 2003


I agilzoope bceasue I msiesd rnaiedg your msagese unitl I saw a rlepy.

I'm delgehitd taht you are cientarg a cnompay to exiplot tihs marouvles
pnmenoehon. If you are looikng for aiidndotal team mebmers for yuor work
snrlibcmag txet, I simbut this, the paorrgm I wtore when I haerd of
this ireesttnnig and ueufsl (or mbaye jsut ireeitsnntg) eefcft.

I hope it metes wtih yuor approval, tuhgoh wehn tarteed wtih ilestf
(and a maoterde aomunt of uesr ivtintorenen, it lsot sangtcniilfiy
more rlaaitebdiy than the visoern wtriten in the other 'P' luangage.
Stetrad wtih more, lsot more, raetenid mroe...).

In-serbmclad-txet-ly y'rs

kb

"""
Srbmlcae
by Kiven Beultr 2003 pthyon-kbuletr at sdabayi.com
Rlaseeed into pibulc dmioan wtih no wrtanray
Use at yuor own rsik
"""
import sys
import random
import re

def srbmlcae( wrod ):
    ieiedsns = list( wrod[1:-1] )
    random.shuffle( ieiedsns )
    return wrod[0] + ''.join( ieiedsns ) + wrod[-1]
    
def scRbaelmrx( match ):
    return srbmlcae( match.group() )

for lnie in sys.stdin:
    print re.sub( "\w{4,}", scRbaelmrx, lnie )[:-1]





More information about the Python-Dev mailing list