Python02 grammar

The third day

  • Python syntax
    • Code indentation
      • Block: distinguishing code scope
      • Indent: Python use 4个空格or 一个TAB键indentation
      • Example:

        if 12 < 16:
            print("12的值比16小!")
        print("我早就知道了")
    • Note: The program will not be executed, the code is to improve the reading experience to the people writing the code to see
      • Single-line comments: Use the #beginning number, followed by the # sign execution of the program content will be ignored
      • Examples of single-line comments:

          # 这是一段注释内容,程序不会执行,我只是想告诉其他编写/阅读代码的人,下面的代码是向屏幕打印输出 hello
          print("hello")
      • Results of the:e8Dhkj.png
      • Multi-line comments - the single quotation marks (English): use '''多行注释内容'''or """多行注释内容"""can be multi-line
      • Examples of multi-line comments:

          '''
          这里是使用的多行注释
          Python代码执行时会
          忽略这段内容,哈哈哈
          '''
          print("Hello Python!!!")
      • Results of the:e8y1Yj.png

Guess you like

Origin www.cnblogs.com/thloveyl/p/11285124.html