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)