Nov-08-2016, 07:54 PM
Hello!
In Python 3 str.translate() works a bit different.
In Python 3 str.translate() works a bit different.
Python 3.5.2 (default, Sep 10 2016, 08:21:44) Type "copyright", "credits" or "license" for more information. IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: file_name = '0012ow32jioo123.hh1' In [2]: table = {} In [3]: for key in range(10): ...: table[ord(str(key))] = None ...: In [4]: table Out[4]: {48: None, 49: None, 50: None, 51: None, 52: None, 53: None, 54: None, 55: None, 56: None, 57: None} In [5]: new_file = file_name.translate(table) In [6]: new_file Out[6]: 'owjioo.hh'I suppose you want to do this on the base name of the file not to an extension too. As you see is 'hh' now. This will ruin your mp3 collection