In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to operate Python modules and functions. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Modules and functions
Use the PyImport_Import () function in Python/C API to import the Python module in a C program. The PyImport_Import () function returns a module object. The function prototype is shown below.
PyObject* PyImport_Import (PyObject* name)
The meaning of the parameters is as follows. Name: the name of the module to import. Using the PyObject_CallObject () function in Python/C API and the PyObject_CallFunction () function, you can call functions in Python in a C program. The parameter prototypes are shown below.
PyObject* PyObject_CallObject (PyObject* callable_object, PyObject* args) PyObject* PyObject_CallFunction (PyObject* callable, char * format,...)
For the PyObject_CallObject () function, the arguments mean the following.
Callable_object: the function object to be called.
Args: a list of parameters in tuple form.
For the PyObject_CallFunction () function, the arguments mean the following.
Callable_object: the function object to be called.
Format: specifies the type of parameter.
The argument passed to the function.
Use the
PyModule_GetDict ()
Function to get a list of functions in the Python module.
PyModule_GetDict ()
Function returns a dictionary. The keyword in the dictionary is the function name and the value is the calling address of the function. The function prototype is shown below.
PyObject* PyModule_GetDict (PyObject* module) the above content is how to operate Python modules and functions. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.