标签:ddr ctypes 内存地址 内存 types ring ESS object sys
import ctypes
from ctypes import string_at
from sys import getsizeof
from binascii import hexlify
value="我和你"#‘hello world‘ #定义一个字符串变量
address=id(value) #获取value的地址,赋给address
get_value=ctypes.cast(address, ctypes.py_object).value #读取地址中的变量
print(get_value)
value1=hexlify(string_at(address,getsizeof(value)))
print(value1)
标签:ddr ctypes 内存地址 内存 types ring ESS object sys
原文地址:https://www.cnblogs.com/phoenix-mountain/p/13071726.html