7.16python日学变量类型及字符串操作

it2022-05-05  127

7.16

数字类型 数字,字符串,列表混合数字类型自动升级 例如print(True+10)强制转换 int(),float(),bool()变量

a = 15

print(type(a))

5 .共享引用

a = 10

b = a

a = 5

print(b)

6.字符串的拼接,重复

a = ‘3’

b=‘4’

print(a+b)

a=‘bc’

print(a*3)

7.chr()与ord()

a = input(‘enter A-Z:’)

ch = ord(a)

print(ch-64)


最新回复(0)