Python:检查整数中的数字

-2 python integer

你如何检查python的整数?基本上是一个函数,如果8是整数,则返回true.so function(8291)返回True但函数(777)返回false.搜索数字的诀窍是什么?

Dan*_*olo 7

def contains_digit(digit, number):
    return str(digit) in str(number)
Run Code Online (Sandbox Code Playgroud)