Import constants from .h file into python

前端 未结 4 1001
青春惊慌失措
青春惊慌失措 2021-02-07 09:56

I\'ve been looking for a simple answer to this question, but it seems that I can\'t find one. I would prefer to stay away from any external libraries that aren\'t already includ

4条回答
  •  礼貌的吻别
    2021-02-07 10:20

    I recommend using regular expressions (re module) to parse the information you want out of the files.

    Building a full C parser would be huge, but if you only use the variables and the file is reasonably simple/predictable/under control, then what you need to write is straightforward.

    Just watch out for 'gotcha' artifacts such as commented-out code!

提交回复
热议问题