【发布时间】:2015-07-26 19:09:15
【问题描述】:
我在网上看一些代码,我看到了一些我不习惯的代码。最引起我注意的是:
if not isinstance(string, str):
#dosomething
如果我这样做会有什么不同:
if type(string)!=str:
#dosomething
【问题讨论】:
-
一般建议:当您有 python 问题时,请使用 python 标签。如果问题是特定于 python-3.x 的,请使用这两个标签。这应该会增加观众的数量。
标签: python python-3.x types