我有一个 .txt 文件,例如:
Symbols from __ctype_tab.o:
Name Value Class Type Size Line Section
__ctype |00000000| D | OBJECT |00000004| |.data
__ctype_tab |00000000| r | OBJECT |00000101| |.rodata
Symbols from _ashldi3.o:
Name Value Class Type Size Line Section
__ashldi3 |00000000| T | FUNC |00000050| |.text
我如何解析这个文件并获得 FUNC 类型的函数? 另外,我如何从这个 txt 中解析和提取 .o 名称?
我如何通过逐列解析或其他方式获取它们。
我需要立即帮助...像往常一样等待合适的解决方案
请您参考如下方法:
for line in open('thefile.txt'):
fields = line.split('|')
if len(fields) < 4: continue
if fields[3].trim() != 'FUNC': continue
dowhateveryouwishwith(line, fields)
