matplotlib中文字体
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import seaborn as sns
font_manager.fontManager.addfont(r'C:\Users\Admin\AppData\Local\Microsoft\Windows\Fonts\NotoSansSC-Regular.otf')
plt.figure(
figsize=(20, 10),
dpi=128,
)
python2 打印中文问题 UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in position
先上代码
pfmt_ascii = pprint.pformat(pyobj_json).encode('ascii')
pfmt_utf_8 = pfmt_ascii.decode('unicode-escape').encode('utf-8')
sys.stdout.write(bytes(pfmt_utf_8))
sys.stdout.write('\n')
sys.stdout.flu