简体   繁体   中英

How do I parse non-English date strings in Python?

I'm trying to parse some non-English datetime strings in Python. I've had success with Western European languages such as French, Spanish and Italian. However, for Czech, Finnish and Greek I have been unsuccessful.

I am setting the locale as follows:

locale.setlocale(locale.LC_TIME, 'ell')

I've been unable to find any code examples online, or any documentation. Is there somewhere that the datetime model details what languages are supported?

I am running on Windows.

Thanks.

Locales tend to use a combination of 2-digit ISO-639 language codes and 2-digit ISO-3166 country codes . Your example uses 'ell' for what I assume should be Greek; try el_GR instead. Similarly, Czech would be cs_CZ and Finnish fi_FI .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM