0

Is there any way to append items to a maketrans() table? (Python 3.7)

I have this line that creates a translation table for regular Ascii Punctuation symbols. Now I'd like to add some more Unicode symbols...

table = str.maketrans('', '', string.punctuation)

Thanks!

  • 1
    The result from a maketrans is a dictinary. You can add as many elements into the dictionaly as possible as long as you are using the AScii codes – Onyambu Jul 16 '18 at 05:43
  • What exactly did you try and research about the result of `str.maketrans` and what is your specific problem? Did you find this: [how to explain the str.smaketrans function in python](https://stackoverflow.com/questions/41535571/how-to-explain-the-str-maketrans-function-in-python-3-6) – Patrick Artner Jul 16 '18 at 06:01
  • Working on a non-English text processing program handling book-length text...Need a performant way to do this: Strip a text off basic Ascii punctuations...perform some business logic (which might result in some punctuations added back)...then strip text again including additional unicode symbols (like க ந ச etc). Currently I'm building having another `table2` but it seems less optimal than adding to original `table`. – Muthu Muthu Jul 16 '18 at 06:22

0 Answers0