Reputation: 3
Below is my code:
import calendar
chinese = calendar.LocaleTextCalendar(6, "CHINESE")
chinese.pryear(2016)
The calendar printed out is not able to display the month and day in Chinese characters.
Upvotes: 0
Views: 369
Reputation: 45
CHINESE
is not a valid locale. You can use zh_CN.UTF-8
:
import calendar
chinese = calendar.LocaleTextCalendar(calendar.SUNDAY, "zh_CN.UTF-8")
chinese.pryear(2024)
For reference: The first part of the locale is a language code ("zh") and country code ("CN") joined by a hyphen ("-") or underscore ("_"). The country code is optional. Valid language and country codes can be found here.
Upvotes: 0
Reputation: 46
chinese = calendar.LocaleTextCalendar(6, "zh_CN.UTF-8")
CHINESE
is not local set, you should serve a correct local, zh_CN.UTF-8
will work. Good luck!
Upvotes: 1