且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查数字列表中是否存在数字

更新时间:2022-01-03 19:14:54

您必须对以下内容进行字符串比较此

You would have to do string comparisons for this

for number in numbers:
    if '4' in str(number):
        print('{} True'.format(number))
    else:
        print("False")

问数字 4 是否在另一个数字中并没有什么意义(除非您对 in有一些特殊的定义) )

It isn't really meaningful to ask if the number 4 is "in" another number (unless you have some particular definition of "in" in mind)