python 整体注释:选中所有然后CTRL+?
运算符
+ – * / ** % //
布尔值
true 真 False 假
!=不等于
<>不等于
算数运算,赋值运算,比较运算,逻辑运算,成员运算
基本数据类型
数字
a=123
字符串
s=”asdf”
列表
list
元祖
tuple
字典
dict
布尔值
bool
字符串的调用程序
#将字符串中的每个元素按照指定分割符进行拼接
test=“我爱你”
print(test)
t="-"
a=t.join(test)
print(v)运行结果:
我爱你
我 爱 你
.ljust
test="aaa"
n=test.ljust(5,"#")
print(n)运行结果:
aaa##
.rjust
test="aaa"
n=test.rjust(5,"#")
print(n)运行结果:
##aaa
.zfill
test="aaa"
n=test.zfill(5)
print(n)运行结果:
00aaa
.islower
test="Aaa"
n1=test.islower()
n2=test.lower()
print(n1,n2)
运行结果:
False aaa
.isupper
test="Aaa"
n1=test.isupper()
n2=test.upper()
print(n1,n2)
运行结果:
False AAA