摘要:
# 判断对象是否可调用,可调用,即对象后加() s = "abc" ls = [1,2,3] def f(): pass class F(): pass t =(s, ls, f, F) for obj in t: if callable(obj): print(obj, True) else: print(obj, Fal... 阅读全文
摘要:
# source是字符串,则使用str.encode()转换 b = bytes('abc',encoding='utf-8',errors='strict') print(b,b[0]) # bytes对象不可变 try: b[0] = 100 except TypeError as err: print('it is immutable.so',err) 阅读全文
摘要:
bytearray: 类,可变字节数组 阅读全文