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