确定数据类型和类型转换
# 确定数据类型,传入的数是一个类型,返回True
print(isinstance('111',str))
print(isinstance(111,str))
print(isinstance([1,2,3],list))
print(isinstance({1:2},dict))
###
True
False
True
True
data = b'hello s11'
data = str(data, encoding='utf-8')
print(data,type(data))
data = bytes(data, encoding='utf-8')
print(data,type(data))