1

I try to read a csv-file with german month days like 'Mai' etc. When I try: datetime.date.strptime('Mai 2009','%B %Y')) it results in a

ValueError: time data 'Mai 2009' does not match format '%B %Y'

The defaultlocale ist 'de_DE'

Is there an easy solution for translation ?

UGin
  • 11
  • 3
  • take a look at [this question](https://stackoverflow.com/questions/18593661/how-do-i-strftime-a-date-object-in-a-different-locale/24070673) – gogaz Aug 16 '18 at 13:58
  • You need to use at least `locale.setlocale(locale.LC_TIME, '')` to make the locale effective. See also the respective section from Python's [documentation](https://docs.python.org/2/library/locale.html#background-details-hints-tips-and-caveats) – dhke Aug 16 '18 at 14:00

0 Answers0