python - reload(sys)报Undefined variable: reload错误
PHP中文网
PHP中文网 2017-04-18 09:03:14
0
3
904

author = 'jyang'
import sys
import json
reload(sys)
sys.setdefaultencoding('utf-8')
还报Undefined variable from import: setdefaultencoding错误

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
伊谢尔伦

What version of python?

左手右手慢动作

There is a possibility that python3 has been used
reload has been placed in another location,

from imp import reload

But sys.setdefaultencoding('utf-8') is no longer meaningful,
Because python3 uses unicode, there is no need to set utf-8 anymore

伊谢尔伦
from importlib import reload
reload(modulename)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!