8
python3 datetime.datetime.strftime failed to accept utf-8 string format
what I did is::
# encoding: utf-8
import datetime
f = "%Y年%m月%d日"
now = datetime.datetime.now()
print( now.strftime(f) )
and what I get is:
D:\pytools>python a.py
Traceback (most recent call last):
File "a.py", line 6, in <module>
print( now.strftime(f) )
UnicodeEncodeError: 'locale' codec can't encode character '\u5e74' in position 2
: Illegal byte sequence
Why and how can I fix this?