Python的简介

python发展背景
python作者 Guido von Rossum 龟叔,Python本身由诸多其他语言发展而来,python目前有两个版本,python2.x和python3.x
python特点
优点:规范代码,简单,易学,高层语言,跨平台,支持面向对象编程,丰富的库等优点
缺点:执行效率慢,这个是解释型语言所通有的

python中的基本语法

在编程语言,存储一个数据,需要用变量进行接收
变量名 = 值
age = 18
查看变量类型
print(type(age))

标识符

什么标识符?
开发人员在程序中自定义的一些符号和名称
标识符是自己定义的,如变量名、函数名等
命名规则
标识符只能由字母 、下划线"_"、数字组成
标识符不能以数字开头
标识符不能使用关键字标识符对大小写敏感

python中关键字

false none true and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield

输入输出

input(“提示信息:”) 输入
print(“输出的是”) 输出
换行输出 \n

格式化输出

方式一:使用百分号字符串格式化
print("my name is %s and my age is %d " %(name,age))
方式二:使用format字符串格式化
print(“my name is {} ,and my age is {}”.format(age,name))
关键字参数
print("my name is {name} ,and my age is {age} ".format(age=18,name=“jack”))
注释:位置参数(“{0}”.format()),关键字参数(“{关键字}”.format())

注释

单行注释

多行注释
···
代码
···

“”"
“”"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值