【发布时间】:2013-11-25 02:24:04
【问题描述】:
我正在 python shell 中使用 type() 运算符进行试验。我注意到:
type('''' string '''')
返回一个扫描字符串时出错的错误
还是:
type(''''' string ''''')
工作正常并响应找到一个字符串。
发生了什么事?这是否与 type('''' string '''') 被解释为 type("" "" string "" "") 并因此空字符串和未定义变量的无意义连接有关?
【问题讨论】:
-
我很确定这是另一个问题的重复,但我找不到它,我认为它只有一个 Martijn Pieters 的答案,他的答案比上次更好,所以……我放弃搜索了。
标签: python string python-2.7 quotes