gpt4 book ai didi

python - 如何查找变量中的字节数?

转载 作者:太空宇宙 更新时间:2023-11-04 09:11:45 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How do I determine the size of an object in Python?

在 C 中如果我这样做了

USHORT x;
ULONG y;
ULONGLONG yy;

printf("%d %d %d\n", sizeof(x), sizeof(y), sizeof(yy))

输出:2 4 8

如果我要的话,我怎样才能在 Python 中得到这个

valByte = 0x16
valWord = 0x1234
valDWord = 0x12345678
val64Word = 0x1234567887654321

我期望的输出应该是 1、2、4、8

谢谢

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com