I am using Python 3 and I want to translate my file names to have no numbers. The translate function doesn't seem to work in Python 3. How can I translate the file names to have no numbers?
This is the block of code that doesn't work:
file_name = "123hello.jpg"
file_name.translate(None, "0123456789")
Thanks
str.translate
is still there, the interface has just changed a little:
>>> table = str.maketrans(dict.fromkeys('0123456789'))
>>> '123hello.jpg'.translate(table)
'hello.jpg'