Python:
1.概述:
1.语言
2.开发起来简洁 =》 java
2.使用场景:
1.数据分析 =》 numpy 、pandas
2.web 开发 =》 用的不多 、 百度
3.游戏开发 =》 用的不多
4.AI (机器学习、深度学习)
5.爬虫
2.开发python :
1.ide :
1.pycharm =》 idea
2.jupyter =》web 版的开发
3.python 语法
1.基本数据结构
1.数值型
int 整型
2.字符串
str
1.注释
1.单行注释 #
2.多行注释 :
'''
xxxx
'''
"""
xxxx
"""
2.数值类型
1.int
n1 = 10
print(n1)
print(type(n1))
2.float
n2 = 10.1
print(n2)
print(type(n2))
3.str:
1.单引号 或者双引号 【普通字符串的定义】
'a' "abc"
2.多行字符串【跟多行注释有点类似】
"""
asdas
"""
s1 = 'longshao'
s2 = "qiaoshao"
print(s1)
print(s2)
print(type(s1))
print(type(s2))
s3 = '''
xinwei 说咱班美女多,我说 真的多
'''
print(s3)
print(type(s3))
4.运算符
算数运算符:+、-、*、/、%、**、//:
n1 = 5
n2 = 10
n3 = 2
print(n1 + n2)
print(n1 - n2 )
print(n1 * n2 )
print(n1 / n2 )
print(n1 % n2 )
print(n1 ** n3 )
print(n1 // n3 )
比较运算符: == < > != <= >=
1.python 中:
bool
n1 = 10
n2 = 20
print(n1 == n2 )
print(n1 <= n2 )
print(n1 >= n2 )
print(n1 != n2 )
print(n1 > n2 )
print(n1 < n2)
print(type(n1 == n2))
赋值运算符:= += -= /= %= //= **=
n1 = 10
n2 = 20
print(n1)
print(n2)
print("n1=",n1,'n2=',n2)
n2 +=n1
print("n1=",n1,'n2=',n2)
n2 -=n1
print("n1=",n1,'n2=',n2)
n2 /=n1
print("n1=",n1,'n2=',n2)
n2 *=n1
print("n1=",n1,'n2=',n2)
n2 **=n1
print("n1=",n1,'n2=',n2)
n2 //=n1
print("n1=",n1,'n2=',n2)
n2 %= n1
print("n1=",n1,'n2=',n2)
逻辑运算符:and or not
n1 = True
n2 = False
print(n1 and n2)
print(n1 or n2 )
print(not n1 )
成员运算符:in 、not in
s1 = "ningshao"
print('n' in s1)
print('x' not in s1)