O'Reilly logo
  • Brandon Reeser thinks this is interesting:

import string

leet = string.maketrans('abegiloprstz', '463611092572')

s = 'The quick brown fox jumped over the lazy dog.'

print s
print s.translate(leet)

In this example, some letters are replaced by their l33t number alternatives.

$ python string_maketrans.py


Cover of The Python Standard Library by Example


use this for next week's project