QProcess process; process.start("ls"); process.waitForStarted(); while (process.waitForReadyRead()) { QString output = process.readLine(); qDebug() << output; }
QProcess process; process.start("python", QStringList() << "my_script.py"); process.waitForStarted(); while (process.waitForReadyRead()) { QString output = process.readLine(); if (output.contains("Result")) { QString result = output.split(":")[1]; qDebug() << "The result is:" << result; } }In this example, the program executes a Python script called `my_script.py` and searches for a specific output line that includes the word "Result". If it is found, the program extracts the value and displays it on the console. Package/library: Qt (QtCore module)