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())

猜你喜欢

转载自www.cnblogs.com/whitemouseV2-0/p/10170373.html
今日推荐