python 终止程序语法_基本语法和Hello World! Python程序

本文介绍了Python编程的基本语法,包括大小写敏感、路径规范、命令终止符等,并展示了首个“Hello, World!”程序。在Python中,不需要分号结束命令,一行只能写一个可执行语句,或使用分号在同一行内分隔多个命令。字符串可以用单引号、双引号或三引号表示,注释以#开始。缩进是Python的重要规则,用于定义代码块。" 131484302,10448902,JavaScript对象迭代详解:for...in、Object.keys()、values()与entries(),"['javascript', '前端开发', '编程语言']
摘要由CSDN通过智能技术生成

python 终止程序语法

In this tutorial we will try to understand the syntax of python programming. Although, syntax is something that you will understand as you will see more and more programs and examples, but there are a few things that you must know before hand.

在本教程中,我们将尝试了解python编程的语法。 虽然,随着越来越多的程序和示例,您将了解语法,但是您必须事先了解一些内容。

Python语法规则 (Python Syntax Rules)

  1. Python is case sensitive. Hence a variable with name yoyostudytonight is not same as yoYoStudytonight

    Python区分大小写 。 因此,名称为yoyostudytonight的变量与yoyostudytonight yoYoStudytonight



  2. For path specification, python uses forward slashes. Hence if you are working with a file, the default path for the file in case of Windows OS will have backward slashes, which you will have to convert to forward slashes to make them work in your python script.

    对于路径规范,python使用正斜杠 。 因此,如果您使用的是文件,则在Windows操作系统中,该文件的默认路径将带有反斜杠,您必须将其转换为正斜杠才能使其在python脚本中正常工作。

    For window's path C:\folderA\folderB relative python program path should be C:/folderA/folderB

    对于窗口的路径C:\folderA\folderB相对的python程序路径应为C:/folderA/folderB



  3. In python, there is no command terminator, which means no semicolon ; or anything.

    在python中, 没有命令终止符 ,这意味着没有分号; 或任何东西。

    So if you want to print something as output, all you have to do is:

    因此,如果您希望将某些内容打印为输出,则只需执行以下操作:

    print ("Hello, World!")

    Oops! we just shared the first python program too with you. Yes, just one single statement.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值