我如何说:"写入将创建(随机数在这里)随机数
def main():
# Open a file for writing
outfile = open ('mynumbers.txt' , 'w')
# Generate random integer number
from random import randint
print(randint(0,9))
main()
答案 0 :(得分:1)
你的意思是以下几点吗?
from random import randint
number = randint(0, 9)
print("Write will create", number, "random numbers")
或者
from random import randint
number = randint(0, 9)
print("Write will create %d random numbers" % number)