美文网首页
Python常用工具函数_简版

Python常用工具函数_简版

作者: 斑马上树 | 来源:发表于2025-03-03 08:14 被阅读0次

    时间关系,没有花太多精力在工具函数的开发上,业务才是王道,工具函数最好用现成的,没有的话交给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

相关文章

网友评论

      本文标题:Python常用工具函数_简版

      本文链接:https://www.haomeiwen.com/subject/wpptqktx.html