python - 如何在 struct.pack 中打包字符串
问题描述
我正在尝试使用 struct.pack 打包字符串。如果我使用整数类型,我可以看到完整的值,但是当我想使用字符串时,我只能看到一个字符。
struct.pack("<1L",0xabcdabcd)
'\xab\xcd\ab\cd'
struct.pack("<1s","overflow")
'o' prints just s. I wanted it to print full string: overflow.
解决方案
推荐阅读
- r - 如何在 dplyr group_by 中使用自定义函数
- angular - Angular 7 Phalcon 多模块结构
- amazon-web-services - 在 Jenkins 声明式管道中执行 aws s3 cp 时命令以退出代码 1 终止
- python - 使用pyserial读取串口十六进制字符串值时,无法得到正确的响应答案
- reactjs - React TypeScript - 永远不应该导出状态?
- button - 如何让两个舵机一个接一个地工作?并停止颤抖?
- javascript - Util 函数将多个 Promise 函数与最后的非 Promise 函数链接起来
- php - PHP - 计算两个日期之间的周数
- r - 将图 ggarrange 与不同的 x 轴时间范围对齐
- python - 如何将 RTMP 流转换为 RTSP 流