等同于 Python 中 C++ 的 std::clog?

Equivalent to C++'s std::clog in Python?

当主程序渲染图像时,这段 C++ 代码将在终端上显示 "loading text"。我知道它这样做是因为 std::clog。我一直在搜索,我认为 subprocess 模块可以帮助我在 Python 上重现它,但我完全不知道如何使用它。您将如何在 Python 中编写代码?

   std::stringstream progress_stream;
   progress_stream << "\r  progress .........................: "
                    << std::fixed << std::setw( 6 )
                    << std::setprecision( 2 )
                    << 100.0 * y / ( buffer_.v_resolution_ - 1 )
                    << "%";

    std::clog << progress_stream.str();

最接近的等价物是print(a_string_variable, file=sys.stderr)