Let say I need a 3 digit number, so it would be something like:
>>> random(3) 563 or >>> random(5) 26748 >> random(2) 56 >
>>> random(3) 563 or >>> random(5) 26748 >> random(2) 56
If you want it as a string (for example, a 10-digit phone number) you can use this:
n = 10 ''.join(["{}".format(randint(0, 9)) for num in range(0, n)])