誰かがこのコードの何が問題なのか説明してもらえますか?
str1='"xxx"'
print str1
if str1[:1].startswith('"'):
if str1[:-1].endswith('"'):
print "hi"
else:
print "condition fails"
else:
print "bye"
私が得た出力は次のとおりです。
Condition fails
hi
しかし、代わりに印刷することを期待していました。