Python正在调用C++函数(使用swig包装)。如何在python中使用std :: wstring
C++:
std::wstring getFilePathMultiByte();
我可以调用这个函数的蟒蛇。问题是我如何使用这个返回的wstring?想要将文件名追加到此路径中,如下面的输出中所示,这会产生错误。
的Python:
path = getFilePathMultiByte()
print path, type(path)
file = path + "/Information.log"
输出:
_2012ad3900000000_p_std__wstring, type 'SwigPyObject'
TypeError: unsupported operand type(s) for +: 'SwigPyObject' and 'str'
如何在Python中创建一个std :: wstring的?这可能会让我连接。
谢谢。
使用类型(路径)查看对象的可用方法。另外,'pprint.pprint(path)'会显示属性。 – jordanm 2012-08-01 20:15:28