I am import from c++ header file into python .py file.can i access the c++ header file #define into python
In python code,
import sys
sys.path.import
I am expected #define's value in running python code It get name error
You can't just import a C++ header into a Python program - they're different languages so it won't work. It's much more complicated than that, see Extending Python with C or C++.
If you just want to pick out #define's from a C++ header file could could simply open that file in your Python program and search for lines that begin with #define and parse the variable and value. Something like:
import re
defines = {}
with open("header_file.h") as header_file:
for line in header_file.readlines():
if line.startswith("#define"):
line.rstrip()
m = re.search('#define\s+([A-Za-z]\w+)\s+(.*)', line)
if m:
defines[m.group(1)] = m.group(2)