Create a Python program 2

Source: Internet
Author: User

After years of editing for Milang's IDE, then press F5 about implementation. This will be in the following output form "Hello, world!" strings, such as the following drawings:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy2fpbw91c2u=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "/>

Congratulations, the simplest Python program you've written has been completed and has become a Python program ape. It's so simple to get started with a language.

Through this simple procedure above. You can see that the Python program does not need to be compiled and can be executed directly. On the basis of this program. You can change the output of it. For example, change hello, world! to Hello, CSDN, or any other sentence that you feel is meaningful. Or maybe you split "Hello, World" into two print () functions to see how it works.

Right, the above program is only the output of English strings, in order to output Chinese strings, but also need to spend a lot of kung fu talent enough. Because the Chinese in the computer expression is more complex than English 26 letters, in the early stage of the computer, in order to produce a variety of Chinese output Hancock endless, arduous struggle. In today's perfect graphics system, the expression of Chinese characters is still more complex. For example, when the interface sees a character as a word, it is actually expressed in two bytes in the computer.

Don't look at just one more byte. That's just a bit more of a byte, and it still brings a lot of problems in today's system.

For example, in combination with English, there are a variety of options, some with two bytes to express Chinese and English, some with two bytes in Chinese, and one byte in English; some use more than two bytes in Chinese, and English adopts a byte mix.

In the Chinese two bytes, also concerned about that a byte in front. That one problem in the back, because the order of two bytes on different CPUs is not the same. Suppose the computer was invented by China. It may become simpler, all bytes are not today's 8 bits, but 16 bits as a byte, so many problems. It's a lot easier. Even when software developers are developing software today, they make the problem a lot of times, and it costs a lot to solve such problems.

Here's how to write a python program output in Chinese, such as the following:

#-*-Coding:utf-8-*-

Print (r "Small language. Hello! ")

In this example, there is a slight change from the previous example. Not only does the string become Chinese, but the string is preceded by a lowercase r, which is used to indicate that the line string uses the original encoding, do not convert, so that the Chinese string encoding will remain unchanged. The original output can be maintained in the resulting output form.

As you can see in the following form:

This example provides a solid foundation for the many other functions of the subsequent programming by understanding the way in which China is lost.

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Create a Python program 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.