一、初识Python
1.简介
python是一种面向对象的解释型(运行的是源代码,不需要编译)计算机编程语言,由荷兰人吉多·范罗苏姆于1989年发明,正真于1991年发布。
2.应用领域
web网站、后台服务、工具脚本、爬虫、数据分析和人工智能等。
3.特点
优点:简单、代码量少、第三方库多等。
缺点:运行速度慢、代码不能加密等。
二、安装py
pythone是跨平台的(通过解释器跨平台),由于是python是解释型语言,所以需要安装解释器,直接到pythone下载安装即可。
三、变量和数据类型
__author__ = 'youHui'
print('这是输出语句')
# 变量和数据类型
# 变量:声明变量时不需要声明其类型
# 数据类型:字符串、整型、列表、元组、字典、布尔型等等
# 整型int
a=12345
print(type(a))
print("=================")
# 浮点型float
b=12.4
print(b,type(b))
print("=================")
# 字符串str
c='这是c'
d="这是d"
print(c,type(c))
print("=================")
# 字符串有多行内容时,可用''' ''''包裹
e='''
这是
多行
字符串
'''
print("多行内容是:"+e,type(e))
print("=================")
#有关字符串
# 字符串转数值
a = '123'
print(type(a))
b = int(a)
print(type(b))
# 字符串转浮点型
c = '13.13'
d = float(c)
print(d,type(d))
# 数值转为字符串
e = 12
f = str(e)
print(f,type(f))
#布尔bool
f=True
print(f,type(f))
g = 5 < 3
print(g)
print(6+True) #True表示1,False表示0
print("=================")
#空值 NoneType
h = None
print(h,type(h))