Home>Article>Backend Development> Solution to the problem of Pycharm outputting Chinese or printing garbled Chinese characters in python (picture)

Solution to the problem of Pycharm outputting Chinese or printing garbled Chinese characters in python (picture)

黄舟
黄舟 Original
2018-05-21 09:07:18 8634browse

This article mainly introduces the solution to the problem of Pycharm outputting Chinese or printing garbled Chinese characters inpython. It has certain reference value. Interested friends can refer to it.

1. Make sure to add the following code at the beginning of the file:

# -*- coding:utf-8 -*-

You can also add

import sys reload(sys) sys.setdefaultencoding('utf-8')

to ensure the following.

If the Chinese garbled characters are still not solved, then proceed to method 2.

2. Enter the setting

## Click to open, click

After the modification is completed, the result is as follows

Click "ok".

success.

The above is the detailed content of Solution to the problem of Pycharm outputting Chinese or printing garbled Chinese characters in python (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn