/
BirdLeon
/
ROBLOX2016
Обзор
Документация
Войти
/
BirdLeon
/
ROBLOX2016
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Library/boost/libs/python/doc/reference/import.qbk
31 строка
794 B
PatoFlamejanteTV
full source code
19 дек 2024, 19:11
19 дек 2024, 19:11
05db15d
Код
Авторство
О чём код?
[section boost/python/import.hpp] [section Introduction] Exposes a mechanism for importing python modules. [endsect] [section Function `import`] ``object import(str name);`` [variablelist [[Effects][Imports the module named by name.]] [[Returns][An instance of object which holds a reference to the imported module.]] ] [endsect] [section Examples] The following example demonstrates the use of import to access a function in python, and later call it from within C++. `` #include <iostream> #include <string> using namespace boost::python; void print_python_version() { // Load the sys module. object sys = import("sys"); // Extract the python version. std::string version = extract<std::string>(sys.attr("version")); std::cout << version << std::endl; } `` [endsect] [endsect]