[nycbug-talk] Re: Spam probes

Bob Ippolito bob
Tue Nov 9 18:02:10 EST 2004


On Nov 9, 2004, at 17:53, a nice bug wrote:

> Bob Ippolito:
>>
>> % echo "galis.org" | python -c "print ''.join([('&#%d;' % ord(c)) for 
>> c
>> in raw_input()])"
>> galis.org
>>
>
> Python??
>
> egads ... Perl!!
>
> echo 'nycbug at hastek.com' |perl -e 'do { s/(.)/"&#".ord($1).";"/eg; 
> print; } while <STDIN>;'
>
> ok, ok, just kidding don't want to start a flame war...
>
> Pedantically speaking:) both Python and Perl will print any 2-digit
> code without the leading zero, even though the proper codeset I
> believe, has leading zeros..  e.g., .

Since I used the %d formatter it's a trivial change to the Python 
version:

echo "galis.org" | python -c "print ''.join([('&#%03d;' % ord(c)) for c 
in raw_input()])"

-bob





More information about the talk mailing list