Python's print statement python comment

Source: Internet
Author: User

Don't say a word, just cut to the chase. The print statement can output the specified text to the screen. For example, the output of ' Hello, world ', implemented in code as follows: >>> print ' Hello, world 'Attention: 1. When we write code in a python interactive environment,,>>> is the prompt for the Python interpreter, not part of the code. 2. When we write code in a text editor, never add >>> The print statement can also be followed by multiple strings, separated by a comma "," that can be connected to a string of outputs: >>> print ' The quick brown fox ', ' Jumps over ', ' The Lazy dog ' The quick brown fox jumps over the lazy dog print prints each string sequentially, encounters a comma "," and outputs a space, so the output string is spelled like this. Print also prints integers, or calculates the result: >>> Print #运行结果
>>> print + #运行结果 Therefore, we can print the results of the calculation 100 + 200 more beautifully: >>> print ' + + = ', + +
+ #运行结果 Note: For the + 200,python interpreter automatically calculates the result 300, but, ' 100 + 200 = ' is a string rather than a mathematical formula, Python treats it as a string, please explain the above printing results yourself.

at any time, we can add comments to the program. Annotations are used to illustrate the code, to yourself or others, and when the program runs, the Python interpreter ignores comments directly, so there is no comment that doesn't affect the execution of the program, but it affects whether someone can read your code. Python's comments to #Beginning, followed by text until the end of the line is counted as comments# This line is all a comment ...
print ' Hello ' # This is also a comment Note there is also a clever use, that is, some code we do not want to run, but do not want to delete, you can temporarily block out the comment:

want to see more detailed please see http://note.youdao.com/noteshare?id=1b9746b7432440ad7334070067d45143&sub= 6C01CC4588AE4B198025EE29DC44F5CA

Python's print statement python comment

Related Article

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.