Python - Get build-id from an ELF file
I'm trying to extract the build-id from and ELF file (Linux kernel module). Right now it's开发者_开发知识库 using:
subprocess.check_output(['eu-readelf', '-n', filename]).split()[-1]
I was wondering is there's a more pythony way to achieve the same result?
Thanks, Alex.
Calling the eu-readelf
command from python, as you have done, is the most elegant and readable approach. Since python stresses readability, I'd say this is the most Pythonic approach.
精彩评论