时间关系,没有花太多精力在工具函数的开发上,业务才是王道,工具函数最好用现成的,没有的话交给IT运维人员更为合适,已有的整理如下。
字符类型检测
import chardet
str = "xxxxx"
str_type = chardet.detect(str)
code = str_type['encoding']
代码运行时间
import time
import numpy as np
s = time.time()
x_cpu = np.ones((1000,1000,1000))
e = time.time()
print(e - s)
附,参考资料:
1、Python中遇到"UnicodeDecodeError,https://www.cnblogs.com/fclbky/articles/4175788.html