Write a HelloWorld in Python

Of course, here is the Python code:

print("你好,世界!")

Note: When you need to use Chinese in a Python program, you need to add a line at the beginning of the file # -*- coding: utf-8 -*-. This line of comments tells the Python interpreter to use UTF-8 encoding to read the source code so that Python can handle Chinese correctly.

For example:

# -*- coding: utf-8 -*-
print("你好,世界!")

After running this code, you will see the output:

你好,世界!

Guess you like

Origin blog.csdn.net/weixin_35756624/article/details/129599782