isdigit不适合我

aka*_*kaa 5 python python-2.7

def listMaker(a, b):
    if b.isdigit() == False:
         print("Sorry is not a valid input")
    else:
         newList = [a] * b
         return newList
Run Code Online (Sandbox Code Playgroud)

我收到错误:

AttributeError: 'int' object has no attribute 'isdigit'
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

toi*_*ine 0

似乎只有string类型有这个方法,而不是int。看那边