Home > Backend Development > Python Tutorial > 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)

黄舟
Release: 2018-05-21 09:07:18
Original
8767 people have browsed it

This article mainly introduces the solution to the problem of Pycharm outputting Chinese or printing garbled Chinese characters in python. 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 -*-
Copy after login

You can also add

 import sys
 reload(sys)
 sys.setdefaultencoding('utf-8')
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template