补充模块

Posted hmw112626

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了补充模块相关的知识,希望对你有一定的参考价值。

 

struct模块  

import struct

# 压包
res = struct.pack(i,999999999)
print(res)
print(len(res))

# 解包
obj = struct.unpack(i,res)
print(obj[0])

 

subprocess模块

import subprocess

res=subprocess.Popen(dir,
            shell=True,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE)

print(res.stdout.read().decode(gbk))

 

UUID模块

import uuid

ret = uuid.uuid4()
print(ret,type(ret))

ret = uuid.uuid4()
ret = str(ret)
print(ret,type(ret))

ret = str(uuid.uuid4())[0:5]
print(ret,type(ret))

 

以上是关于补充模块的主要内容,如果未能解决你的问题,请参考以下文章

vs 2010代码片段

如何使用模块化代码片段中的LeakCanary检测内存泄漏?

js常用代码片段

如何有条件地将 C 代码片段编译到我的 Perl 模块?

26个jQuery代码片段使用技巧

CTS测试CtsWindowManagerDeviceTestCases模块的testShowWhenLockedImeActivityAndShowSoftInput测试fail项解决方法(代码片段