windows7,python3使用time.strftime()函数报ValueError: embedded null byte

     

 

     windows7环境下,执行代码报ValueError: embedded null byte时,在原代码前面加一行代码:locale.setlocale(locale.LC_ALL,'en')即可解决

即:

locale.setlocale(locale.LC_ALL,'en') 
locale.setlocale(locale.LC_CTYPE,'chinese')
ws["C3"]=time.strftime('%Y年%m月%d日 %H时%M分%S秒',time.localtime())

posted @ 2018-12-24 18:57  WhiteMouse  Views(3655)  Comments(1)    收藏  举报