Git Product home page Git Product logo

Comments (5)

romainthomas avatar romainthomas commented on May 22, 2024

Could you be more precise about the API you would like ?

from lief.

Rafiot avatar Rafiot commented on May 22, 2024

I'd like to be able to do things like that:

for key, value in pe.resources_manager.version.string_file_info.langcode_items[0].items():
    print(key, value)

But in general, having such APIs for everything that looks like a dictionary in the whole project would be great.

from lief.

romainthomas avatar romainthomas commented on May 22, 2024

Well actually the underlying C++ container is a std::map: include/LIEF/PE/resources/LangCodeItem.hpp#L96 and the translation to Python (thanks to pybind11) is performed with a dict like. The conversion to collections.abc.MutableMapping is not trivial

But you can iterate over the items property as follow:

for k, v in pe.resources_manager.version.string_file_info.langcode_items[0].items.items():
    print(k, v)

from lief.

Rafiot avatar Rafiot commented on May 22, 2024

Hmmm, yeah, I get the problem.
The list of tuples if fine for me to get the data out, but if you want to edit it at some point, it will be tricky.

from lief.

Rafiot avatar Rafiot commented on May 22, 2024

FYI, I create my dict this way:
dict(pe.resources_manager.version.string_file_info.langcode_items[0].items)

from lief.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.