Python Forum
string.punctuation for languages like French or German
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string.punctuation for languages like French or German
#1
string.punctuation gives me '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~',
but that's not sufficient for other languages like French or German. What I can I do with other languages?
Reply
#2
You could make a unicode_punctuation.

https://stackoverflow.com/questions/6098...just-ascii
import sys
from unicodedata import category


punctuation_chars =  [
    chr(i) for i in range(sys.maxunicode)
    if category(chr(i)).startswith("P")
    ]
If you have to work with foreign languages, look for gettext and babel. The programmer does i18n (internationalization) and the translators are doing the l10n (localization).
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read from image with several languages using inage_to_string()? EvilSnail 0 2,066 Nov-13-2021, 03:11 PM
Last Post: EvilSnail
  Where does string.punctuation come from? Mark17 5 2,916 Sep-16-2019, 04:42 PM
Last Post: Mark17
  Removing punctuation from strings in lists iFunKtion 3 16,733 May-21-2017, 06:43 PM
Last Post: Larz60+
  Nouns and corresponding verbs in German MattaFX 0 1,976 Apr-28-2017, 07:53 AM
Last Post: MattaFX

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020