[英]Calling a python program with c++
我想制作一個c++程序,該程序將從文件中搜索 href 並且需要抓取該 href。 為此,我使用 python 從 href 中抓取數據並將其保存在文件中。 現在我的問題是如何將 href 發送到 python 程序?
您可以執行命令並讓 python 解釋器來完成這項工作。
int result = system("python_path python_file_path.py");
或者 Boost 有一個Boost.Python的庫
我想制作一個 c++ 程序,它將從文件中搜索 href
(請注意,您不需要 python ;您需要解析HTML;您會找到 C++ 庫,例如myhtml )。
現在我的問題是如何將 href 發送到 python 程序?
這是特定於操作系統的,也特定於您的 Python 程序。 閱讀更多關於 C++ 的信息。 注意std::system
閱讀關於嵌入和擴展 python的章節。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.