我正在尝试在Python中调试代码。当我进入调试模式并在word正常工作的类似代码中查看变量时,我看到此变量的类型显示为{str},但在其他无法正常工作的代码中,我看到word了调试器中的类型作为{str_}。这些之间有什么区别,以及如何将变量类型{str_}转换为类型{str}。
这是代码的一部分:
cv = CountVectorizer(min_df=1, charset_error="ignore", stop_words="english", max_features=200)
counts = cv.fit_transform([text]).toarray().ravel()
words = np.array(cv.get_feature_names())
...
for word, count in zip(words, counts):
Run Code Online (Sandbox Code Playgroud)
我使用PyCharm进行调试,它在Python 3.3中。
我对此表示感谢。
str可能是内置的str。str_还有其他的东西。也许是的子类str?看不见就很难说
编辑:
像看起来str_可能numpy.str_是,如果你倒海峡的列表为numpy的数组,你会得到什么