补充模块

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))

猜你喜欢

转载自www.cnblogs.com/hmw112626/p/9651590.html