This has always worked fine for me.
>>> import string
>>> id = "Peter! *fine*"
>>> transtab = string.maketrans('/ ','_ ')
>>> print string.translate(id, transtab, '?&!;<=>*#[]{}')
Peter fine

Now if I do it with a unicode string:

>>> id = u"Peter! *fine*"
>>> transtab = string.maketrans('/ ','_ ')
>>> print string.translate(id, transtab, '?&!;<=>*#[]{}')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/string.py", line 493, in translate
    return s.translate(table, deletions)
TypeError: translate() takes exactly one argument (2 given)

That doesn't seem fair. Is this a know bug perhaps? I tried googling
for it.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to