小编vsc*_*vsc的帖子

将一个字符串与另一个字符串的多个子字符串进行比较

有没有另一种更简单的方法来编写代码,基本上检查字符串的每个字符 'abcde'

if input == 'a' or input == 'ab' or input == 'abc' or input == 'abcd' or input == 'abcde':
    return True
Run Code Online (Sandbox Code Playgroud)

python string string-comparison

30
推荐指数
4
解决办法
762
查看次数

标签 统计

python ×1

string ×1

string-comparison ×1