如何通过python结构模块以小末日格式转换一个内存地址

发布于 2025-02-05 04:50:58 字数 271 浏览 1 评论 0原文

我需要将存储地址转换为以下符号:uint32 Little Endian(DCBA) 我在网上找到了结构模块,但是我无法弄清楚要使用哪种参数来获取所需的内容。 例如,我需要转换以下:0x8048424并输出以下:\ x24 \ x84 \ x04 \ x08 我已经尝试过,但是输出省略了序列\ x24:

import struct
x= struct.pack('<L',0x8048424 )
print(x)

但是它删除x24,用于打包的正确值是什么?

I need to convert a memory address to the following notation: uint32 little endian (DCBA)
I found the struct module online, but I can't figure out which parameter to use to get what I need.
For example I need to convert this:0x8048424 and get in output this: \x24\x84\x04\x08
I tried this already, but the output omits the sequence \x24:

import struct
x= struct.pack('<L',0x8048424 )
print(x)

But it delete x24, what is the correct value to pass to pack for my purpose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文