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

问题描述:

如何查看索引中是否包含某些数字?

How can I see if an index contains certain numbers?

numbers = [2349523234, 12345123, 12346671, 13246457, 134123431]

for number in numbers:
    if (4 in number):
        print(number + "True")
    else:
        print("False")


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

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)