机器人框架内置`转换为字节的关键字仅支持大端

发布于 2025-02-11 00:15:56 字数 422 浏览 0 评论 0 原文

我最后在某些低级任务中使用机器人框架,因此我必须管理一些字节字符串。我需要从内置库,但我找不到使用此关键字处理小端字节订购的小字符串的方法。

我担心这些类型的操作更容易与用户定义的关键字直接在Python中处理,但是请记住,内置的关键字已经被认为是为我完成这项工作的,应该是否可以以大型和小末日格式工作?

如果有人可以告诉我是否转换为字节关键字也可以以某种方式以Little Endian工作,或者除了支持这种格式的内置外,是否存在其他库,我将非常感谢!

I've been lastly working with Robot Framework in some low level tasks, so I have to manage some byte strings. I need to use the Convert To bytes keyword from the BuiltIn Library, but I can't find the way to handle Little Endian byte-ordered strings using this keyword.

I'm concerned that these types of operations are way easier to be handled directly in Python with user-defined keywords, but having in mind that a Built-In keyword is already thought to do this work for me, shouldn't it be able to work both in Big and Little Endian formats?

If someone could tell me if the Convert To Bytes keyword can also work in Little Endian in some way, or if there exist any other library apart from the BuiltIn supporting this format, I'll really appreciate that!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜柠檬 2025-02-18 00:15:56

您可以使用评估关键字borm indendin库。这是我从此。另外,您可以修改它以适合您的输入数据类型。

***Variables***
${int}    1234

*** Test Cases ***  
test 
    ${byte_int}=    Evaluate    (${int}).to_bytes(((${int}).bit_length() + 7) // 8, byteorder='little')
    Log    ${byte_int}

You can use the Evaluate keyword form builtin library. Here is a solution i cooked up from this answer. Alternatively you can modify this to fit your input data type.

***Variables***
${int}    1234

*** Test Cases ***  
test 
    ${byte_int}=    Evaluate    (${int}).to_bytes(((${int}).bit_length() + 7) // 8, byteorder='little')
    Log    ${byte_int}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文