是我的编辑出了问题还是我犯了什么愚蠢的错误?这是屏幕截图
这段代码返回true,它实际上应该
a = "https://www.reddit.com/comments/ado0ym/use_reddit_coins_to_award_gold_to_your_favorite/"
b = "use_reddit_coins_to_award_gold_to_your_favorite"
if b in a:
print("true")
# Results return true
但这必须返回假,但返回真
a = "https: // www.reddit.com/comments/ado0ym/"
b = "use_reddit_coins_to_award_gold_to_your_favorite"
if b in a:
print("true")
# Results return true
工作正常:第一个返回True,第二个返回False:
如果您正在运行代码,它应该正确打印
true
,因为第一个设置为True,然后再不打印:如果两者都是真的,你就会明白
见下表:
输出:
相关问题 更多 >
编程相关推荐